我只是有一個問題,我一直試圖修復時間最長。如何鏈接到Visual C++ 2010中的.lib文件?沒有參考項目?
我有一個Visual c + +中的靜態庫項目,我希望另一個項目能夠鏈接到它。到目前爲止,我只是添加了一個對靜態庫項目的引用,它會自動鏈接庫。
我想只能使用頭文件和.lib文件鏈接到庫。但是,我收到「未解析的外部符號」錯誤。
我以爲自己做得對 - 我指定了include目錄,庫目錄,並進入鏈接器輸入屬性,並提供了lib作爲附加依賴項。
我能夠以這種方式引用其他靜態庫(如SDL),那麼爲什麼我在嘗試引用我的時候會出錯?
感謝您的幫助。
問題是它沒有引用實際的lib文件,或者是lib本身內的東西? 這些都是錯誤的消息,我得到:
錯誤2錯誤LNK2019:無法解析的外部符號 「市民:無效__thiscall XEngine :: XCore :: XScreen ::初始化(類XEngine :: XCore :: XGame &)」(? init?@ XScreen @ XCore @ XEngine @@ QAEXAAVXGame @ 23 @@ Z)在函數「void __cdecl XEngine :: XEngineInit(class XEngine :: XCore :: XScreen &,class XEngine :: XCore :: XGame &)」 XEngineInit @ XEngine @@ YAXAAVXScreen @ XCore @ 1 @ AAVXGame @ 31 @@ Z)C:\ Users \ Xander Masotto \ Documents \ Visual Studio 2010 \ Projects \ Pong \ Pong \ source.obj Pong
錯誤3錯誤LNK2019 :無法解析的外部符號「public:__thiscall XEngine :: XCore :: XScreen ::〜XScreen(void)」(?? 1XScreen @ XCore @ XEngi (XEngineInit @ XEngine @@ YAXAAVXGame @ XCore @ 1 @@ Z)C:\ Users \中引用的函數ne @@ QAE @ XZ) Xander XScreen :: XScreen(void)「(公共:__thiscall XEngine :: XCore :: XScreen :: XScreen(void))無法解析的外部符號」公共:__thiscall XEngine :: XCore :: XScreen :: XScreen (0XScreen @ XCore @ XEngine @@ QAE @ XZ)在函數「void __cdecl XEngine :: XEngineInit(class XEngine :: XCore :: XGame &)」中引用(?XEngineInit @ XEngine @@ YAXAAVXGame @ XCore @ 1 @@ Z )C:\ Users \ Xander Masotto \ Documents \ Visual Studio 2010 \ Projects \ Pong \ Pong \ source.obj Pong
你描述它應該工作。請給出一個(相關的,簡潔的)錯誤抽樣? – 2010-09-09 22:45:39