I'm trying to use log4cpp in my MSVC project. I downloaded log4cpp, and opened its msvc10\msvc10.sln file. I'm using Visual Studio 2012 (msvc11), so it prompted me to update log4cpp's projects. I did and everything seemed to go smoothly. Then I built the log4cppLIB project. It generated msvc10\log4cppLIB\Debug\log4cppD.lib. Seems so far so good.
Back in my own project, I added msvc10\log4cppLIB\Debug to my linker library directories and log4cppD.lib to my linker dependencies. When I try to build my project, I get this error:
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)
Things I've tried:
Maybe my linker path or file name is wrong? Nope, because if I deliberately use a wrong path, then I get a different kind of error (
fatal error LNK1104: cannot open file 'log4cpp.lib'
)Maybe the memory model needs to match? My project is x64 and log4cpp defaults to win32. But nope. I changed log4cpp to x64 and rebuilt. But then re-building my project produces even more errors, of this variety (
error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MDd_DynamicDebug' doesn't match value 'MTd_StaticDebug'
).
Any thoughts?