1
我正嘗試將libprotobuf
鏈接到我的項目。爲了做到這一點,我已經編譯libprotobuf到一個動態庫,這是我的庫路徑。無法鏈接到標準庫
然而,隨着/MD
編譯時,我從連接器收到以下錯誤:
3>libprotobuf.lib(int128.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in component.obj [C:\Projekte\P3D-ECS\p3d_e
於是,我改變了標誌從/MD
至/MT
,和那些消失了。然而,現在連接失敗時與標準庫鏈接,並不能找到符號像std::basic_ostream
,用了很多的錯誤是這樣的:
error LNK2001: unresolved external symbol "__declspec(dllimport) public: __int64 __cdecl std::basic_streambuf<char,struct std::char_traits<char> >::sputn(char const *,__int64)" ([email protected][email protected][email protected]@[email protected]@@[email protected]@[email protected])
我已經嘗試添加libcmt
和MSVCRT
我的鏈接的相關性,但沒有成功。
看來,我的DLL只是無法編譯/MT
標誌,無論鏈接libprotobuf
或不。 我錯過了什麼?
你是否(重新)構建*所有*與CRT動態鏈接? –
是的,我刪除了整個構建文件夾,並做了一個乾淨的重建 - 沒有任何改變 – tobspr
你確定每個庫和exe是用/ MD(或/ MDd在調試中)構建的,即動態鏈接到CRT?你的錯誤消息似乎暗示了靜態鏈接和動態鏈接之間的不匹配...... –