log4cplus的各种坑

前言

项目中需要用到这个日志管理工具,新人,新电脑,之前的项目程序在我的电脑上都跑不起来。一直爆出C000000005的那个错误。  大牛指点之后发现是我电脑上不能用这个日志系统,具体为什么不能用她也没说,所以姐姐我就自己安装下这个工具来试看看,结果各种坑啊。



安装


编译失败

①  error C3861: 'LOG4CPLUS_WARN': identifier not found

添加文件头:

#include   

②  error LNK2019: 无法解析的外部符号 "const log4cplus::Appender::`vbtable'" (??_8Appender@log4cplus@@7B@),该符号在函数 "public: void __thiscall log4cplus::Appender::__autoclassinit(unsigned int)" (?__autoclassinit@Appender@log4cplus@@QAEXI@Z) 中被引用

参考

解决方法:添加于处理器定义   LOG4CPLUS_BUILD_DLL


还是不对

error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall log4cplus::BasicConfigurator::~BasicConfigurator(void)" (__imp_??1BasicConfigurator@log4cplus@@UAE@XZ)
error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall log4cplus::Logger::~Logger(void)" (__imp_??1Logger@log4cplus@@UAE@XZ)
error LNK2001: unresolved external symbol "__declspec(dllimport) void __cdecl log4cplus::detail::macro_forced_log(class log4cplus::Logger const &,int,class std::basic_string,class std::allocator > const &,char const *,int,char const *)" (__imp_?macro_forced_log@detail@log4cplus@@YAXABVLogger@2@HABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PBDH2@Z)
error LNK2001: unresolved external symbol "__declspec(dllimport) class std::basic_ostringstream,class std::allocator > & __cdecl log4cplus::detail::get_macro_body_oss(void)" (__imp_?get_macro_body_oss@detail@log4cplus@@YAAAV?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ)
error LNK2001: unresolved external symbol "__declspec(dllimport) public: bool __thiscall log4cplus::Logger::isEnabledFor(int)const " (__imp_?isEnabledFor@Logger@log4cplus@@QBE_NH@Z)
error LNK2001: unresolved external symbol "__declspec(dllimport) public: static class log4cplus::Logger __cdecl log4cplus::Logger::getInstance(class std::basic_string,class std::allocator > const &)" (__imp_?getInstance@Logger@log4cplus@@SA?AV12@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual void __thiscall log4cplus::PropertyConfigurator::configure(void)" (__imp_?configure@PropertyConfigurator@log4cplus@@UAEXXZ)
error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall log4cplus::BasicConfigurator::BasicConfigurator(class log4cplus::Hierarchy &,bool)" (__imp_??0BasicConfigurator@log4cplus@@QAE@AAVHierarchy@1@_N@Z)
error LNK2001: unresolved external symbol "__declspec(dllimport) public: static class log4cplus::Hierarchy & __cdecl log4cplus::Logger::getDefaultHierarchy(void)" (__imp_?getDefaultHierarchy@Logger@log4cplus@@SAAAVHierarchy@2@XZ)

什么鬼根本不对,不是添加那个处理器的定义

log4cplus的各种坑_第1张图片


这样子应该是对了吧

log4cplus的各种坑_第2张图片

出来结果的时候姐姐都感动哭了


你可能感兴趣的:(log4cplus)