我正尝试在我的MSVC项目中使用log4cpp。我下载了log4cpp,打开了它的msvc10 10\msvc10.sln文件。我使用的是Visual 2012 (msvc11),因此它促使我更新log4cpp的项目。我做到了,一切似乎进展顺利。然后我构建了log4cppLIB项目。它生成了msvc10\log4cppLIB\Debug\log4cppD.lib。到目前为止还不错。
回到我自己的项目中,我将msvc10 10\log4cppLIB\Debug添加到链接器库目录中,将log4cppD.lib添加到链接器依赖项中。当我试图构建我的项目时,我会得到以下错误:
error LNK2019: unresolved external symbol "public: static class log4cpp::Category & __cdecl log4cpp::Category::getInstance(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?getInstance@Category@log4cpp@@SAAEAV12@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) 我尝试过的事情:
fatal error LNK1104: cannot open file 'log4cpp.lib')error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MDd_DynamicDebug' doesn't match value 'MTd_StaticDebug')。有什么想法吗?
发布于 2015-02-06 19:20:02
显然,我确实必须编译为x64,我不得不将Runtime从Multi-threaded Debug DLL (/MDd)更改为Multi-threaded Debug (/MTd)。我不知道为什么一开始就这样,但是.嗯。现在起作用了。:)
https://stackoverflow.com/questions/28372079
复制相似问题