log4cplus的各种坑

前言

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



安装


编译失败

①  error C3861: 'LOG4CPLUS_WARN': identifier not found

添加文件头:

#include <log4cplus/loggingmacros.h>  

②  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


还是不对

<span style="font-size:12px;">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<char,struct std::char_traits<char>,class std::allocator<char> > 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<char,struct std::char_traits<char>,class std::allocator<char> > & __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<char,struct std::char_traits<char>,class std::allocator<char> > 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)</span>

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



这样子应该是对了吧


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


评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值