2011-03-21 40 views
0

這是在Windows控制檯應用程序,所以我不知道這是怎麼發生的。我如何得到一個鏈接錯誤:無法解析的外部符號

#include "Library.h" 

//poglathon.cpp 
//starting region 


bool Poglathon(std::vector<std::string>& text,Player *player){ 
    using namespace std; 
    cout << "You see a town to one side and a path leading to a dark, murky forest in the other side." << endl; 
    int chosen = player->giveOptions(2,"Town","Path","","",""); 
    return true; 
} 
+2

究竟是什麼符號? – 2011-03-21 18:57:04

+0

進一步Let_Me_Be的問題:豬頭,請告訴我們確切的鏈接器錯誤信息。 – 2011-03-21 18:58:27

+0

(不小心點擊註釋)bool __cdecl - 是符號嗎? – pighead10 2011-03-21 18:58:41

回答

3

你在頭文件中的聲明如下:

​​

你嘗試在CPP文件中定義如下:

bool Poglathon(std::vector<std::string>& text,Player * player); 

更改聲明採取Player *而不是一個Player

2

顯然問題是,功能(你的頭文件中)的聲明是這樣的:

​​

但是你定義它是這樣的:

bool Poglathon(std::vector<std::string>& text,Player *player) 

決定你想要什麼,是一致的。

+0

哎呀,我忘了那個聲明。 – pighead10 2011-03-21 19:07:09

相關問題