VS2005.net编译log4cpp1.0 (zt)
来源:互联网 发布:本地小说阅读软件 编辑:程序博客网 时间:2024/05/17 17:58
由于log4cpp1.0仅提供了vc6的工程文件,因此,使用vs2005打开后,需要进行转换。但是转换后,不能正确编译,提示Custom Build Step时出现了错误。
分析:因为log4cpp在生成NTEventLogAppender.dll时,需要连接NTEventLogCategories.mc文件。所以,项目设置了自定义的生成步骤去生成NTEventLogAppender.dll。但从vc6的工程文件转换时,这些步骤却没有正确的转换过来。从而出现上述问题。
解决方法:重新填写Custom Build Step项。
其中,CommandLine填写以下内容:
if not exist $(OutDir) md $(OutDir)
"mc.exe" -h $(OutDir) -r $(OutDir) $(SolutionDir)NTEventLogCategories.mc
"RC.exe" -r -fo $(OutDir)/$(InputName).res $(ProjectDir)/$(InputName).rc
"link.exe" /MACHINE:IX86 -dll -noentry -out:$(OutDir)/NTEventLogAppender.dll $(OutDir)/$(InputName).res
Outputs填写:$(OutDir)/NTEventLogAppender.dll
适用范围:log4cpp项目、log4cppDLL项目的Debug和Release配置。同时,该方法适用于vs2003(vc7.1)。
分割线----------------------------------------------------------------------------------------------------------------------------------
然后编译,8个连接报错,符号找不到
需要修改源代码,找到FactoryParams这个类,将其find的函数的定义由body移到头文件中,继续
分割线----------------------------------------------------------------------------------------------------------------------------------
> 正在创建库 ./Debug/log4cppD.lib 和对象 ./Debug/log4cppD.exp
1>PatternLayout.obj : error LNK2019: 无法解析的外部符号 "void __cdecl log4cpp::localtime(__int64 const *,struct tm *)" (?localtime@log4cpp@@YAXPB_JPAUtm@@@Z),该符号在函数 "public: virtual void __thiscall log4cpp::TimeStampComponent::append(class std::basic_ostringstream<char,struct std::char_traits<char>,class std::allocator<char> > &,struct log4cpp::LoggingEvent const &)" (?append@TimeStampComponent@log4cpp@@UAEXAAV?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABULoggingEvent@2@@Z) 中被引用
1>Debug/log4cppD.dll : fatal error LNK1120: 1 个无法解析的外部命令
将log4cpp-1.0/src下的localtime.cpp中的内容移到localtime.h中,编译。。成功。
(转注:实际上编译8个链接报错符号找不到的原因是工程中缺失FactoryParams.cpp和Localtime.cpp,只需将这2个文件手工加入vc工程中即可,无需改动源码)
- VS2005.net编译log4cpp1.0 (zt)
- VS2005.net编译log4cpp1.0
- VC2005编译log4cpp1.0
- wince6.0 vs2005 编译出错
- VS2005编译PagedGeometry 1.1.0
- vs2005 .net framework2.0 error1603
- 在VS2005 环境下面使用.NET Framework 1.1 进行编译
- 在VS2005 环境下面使用.NET Framework 1.1 进行编译
- 在VS2005 环境下面使用.NET Framework 1.1 进行编译
- 在VS2005 环境下面使用.NET Framework 1.1 进行编译
- [转]VS2005下编译、安装Net-snmp 5.4.1.2
- vs2005环境下编译CEGUI 0.6.0
- opencv2.0 vs2005下的编译
- vs2005环境下编译CEGUI 0.6.0
- vs2005环境下编译CEGUI 0.6.0
- wince6.0 vs2005 编译选项详解
- 【转】wince6.0 vs2005 编译选项详解
- vs2005环境下编译CEGUI 0.6.0
- DEDECMS建站5个优化技巧
- SQL Server Job运行成功或失败时发送电子邮件通知
- 开源的神话
- diff和patch使用指南
- 指针,揭开你的盖头来(三)
- VS2005.net编译log4cpp1.0 (zt)
- FreeTextBox控件上传图片到指定的绝对路径的改进
- 基于Java的OJ(Onlie Judge)实践
- 我的C++实践(7):模板元编程实战
- MontaVista安装
- DEDECMS建站教程
- 看书备忘
- SQL Server宝典(S1)
- Ext.Panel的主要功能