2010-05-04 106 views
2

我正嘗試在Visual Studio 2005上使用多個項目。我有一個項目依賴於另外兩個項目。我在第一個項目解決方案中包含了這兩個項目,並正確設置了依賴關係。當在Visual Studio 2005中包含其他項目時鏈接錯誤(LNK2019)

我鏈接項目時出現此錯誤:

1>server_controller.obj : error LNK2019: unresolved external symbol "public: __thiscall server_communication::TcpServer::TcpServer(class boost::asio::io_service &,struct server_communication::ServerParameters &)" ([email protected][email protected]@[email protected][email protected]@[email protected]@[email protected]@@Z) referenced in function "public: __thiscall server_controller::ServerController::ServerController(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" ([email protected][email protected]@[email protected][email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]) 

我看來,這些符號不能在其他項目中發現,即使在這些項目中定義。

回答

-1

你是如何設置依賴關係的?在C++中,您需要在Project - Properties - Linker - Additional libraries中設置鏈接器依賴項。在這裏添加所需的.lib文件。

關於解決方案依賴關係對話框:它隻影響項目構建順序,但不解決鏈接器依賴關係。

+0

我不得不將子項目構建爲靜態庫,並將這些庫的文件夾包含到鏈接器附加庫中。這工作,非常感謝。 – Arthur 2010-05-04 10:20:00

+0

-1表示不準確。項目依賴項默認DO會自動包含.libs。這可以通過項目設置來抑制,但默認情況下啓用。 – 2010-05-04 10:39:19

相關問題