在vs2010中编译log4cxx-0.10.0详细方法(从下载、编译、解决错误详细介绍)
2015-04-16 11:27
204 查看
本文一共包含了17个步骤,按照下面的步骤就可以完成vs2010中编译log4cxx的工作了。
1. 下载 log4cxx 以及 apr 和 apr-util源码:
a) http://www.apache.org/dyn/closer.cgi/logging/log4cxx/0.10.0/apache-log4cxx-0.10.0.zip
b) http://archive.apache.org/dist/apr/apr-1.2.11-win32-src.zip
c) http://archive.apache.org/dist/apr/apr-util-1.2.10-win32-src.zip
![](http://s5.sinaimg.cn/middle/a459dcf5tc0283c7836d4&690)
2. 将 3个压缩包解压到同一个目录.如下图:
![](http://s11.sinaimg.cn/middle/a459dcf5tc0284463c34a&690)
3. 将 apr-1.2.11重命名为 apr, 将 apr-util-1.2.10 重命名为apr-util.如下图:
![](http://s10.sinaimg.cn/middle/a459dcf5tc0284569bc79&690)
4、打开cmd窗口,如下图所示:
![](http://s16.sinaimg.cn/middle/a459dcf5tc028495a524f&690)
5、在4中输入:cd D:\log4cxx_compile\apache-log4cxx-0.10.0 回车
然后输入:d: 回车后 切换至 apache-log4cxx-0.10.0目录
![](http://s11.sinaimg.cn/middle/a459dcf5tc0284a0ff12a&690)
6、在5中输入:configure.bat 回车
![](http://s11.sinaimg.cn/middle/a459dcf5tc0284ac9451a&690)
7. 在6的基础下dos窗口下继续输入:configure-aprutil.bat回车
![](http://s10.sinaimg.cn/middle/a459dcf5tc0284bea6fe9&690)
[align=left]8、进入D:\log4cxx_compile\apr-util\include中并找到apu.hw文件,如下图:[/align]
![](http://s6.sinaimg.cn/middle/a459dcf5tc0284d6b9bd5&690)
9、用Notepad++打开apu.hw文件(记事本也可以)
![](http://s9.sinaimg.cn/middle/a459dcf5tc0284f9d4b28&690)
手动修改
apr-util\include\apu.hw里的内容
#define APU_HAVE_APR_ICONV1
改为
#define APU_HAVE_APR_ICONV0
![](http://s1.sinaimg.cn/middle/a459dcf5tc02850a397f0&690)
10. 使用VS2010打开
apache-log4cxx-0.10.0\projects 下的
log4cxx.dsw
![](http://s5.sinaimg.cn/middle/a459dcf5t799da1d7fe04&690)
打开工程会提示转换:
![](http://s6.sinaimg.cn/middle/a459dcf5tc02853d2d265&690)
11、转换好后工程如下图:
![](http://s15.sinaimg.cn/middle/a459dcf5tc02855dd1cce&690)
12、将 log4cxx设置为启动项.
设置前:
![](http://s10.sinaimg.cn/middle/a459dcf5tc02857189aa9&690)
设置后:
![](http://s10.sinaimg.cn/middle/a459dcf5tc02857e72a39&690)
13.开始编译.log4cxx
![](http://s9.sinaimg.cn/middle/a459dcf5tc0285920cd68&690)
出现
4>D:\log4cxx_compile\apache-log4cxx-0.10.0\src\main\include\log4cxx/spi/loggingevent.h(155):error C2252: 只能在命名空间范围内显式实例化模板
![](http://s7.sinaimg.cn/middle/a459dcf5t799da2cc35f6&690)
a) 双击 "输出"窗口中的错误行, 此时会在 "代码窗口" 中出现错误的位置.如下图:
![](http://s10.sinaimg.cn/middle/a459dcf5tc0285f25edb9&690)
b) 选择 LOG4CXX_LIST_DEF, 按键盘 F12,此时会跳转到该宏的定义,如下图:
![](http://s6.sinaimg.cn/middle/a459dcf5tc02860480255&690)
c) 将
#define LOG4CXX_LIST_DEF(N, T) \
template class LOG4CXX_EXPORTstd::allocator<T>; \
template class LOG4CXX_EXPORTstd::vector<T>; \
typedef std::vector<T>N
替换为:
#define LOG4CXX_LIST_DEF(N, T) \
typedef std::vector<T>N
![](http://s8.sinaimg.cn/middle/a459dcf5tc02860f371b7&690)
14、按照13修改后,重新编译
出现
2>network_io\unix\multicast.c(137): errorC2079: “mip”使用未定义的struct“group_source_req”错误
双击第一行出错输出, 将 136 和 148 行的 #if MCAST_JOIN_SOURCE_GROUP 注释,替换为 #if defined (group_source_req)
![](http://s7.sinaimg.cn/middle/a459dcf5tc02863394b86&690)
15、按照14修改后,重新编译
出现
'4>..\src\main\cpp\stringhelper.cpp(64):error C2039: “insert_iterator”: 不是“std”的成员'等错误.
![](http://s14.sinaimg.cn/middle/a459dcf5tc0286479d83d&690)
在该 .cpp中(stringhelper.cpp) 加入头文件#include<iterator>
![](http://s1.sinaimg.cn/middle/a459dcf5tc02865bd2f60&690)
16、按照15修改后,重新编译
出现 '无法解析的外部符号 xxx'等错误.
![](http://s3.sinaimg.cn/middle/a459dcf5tc02866e69502&690)
将 apr, aprutil, xml添加至 log4cxx 的引用中.(按照下面4副图的顺序操作)
![](http://s4.sinaimg.cn/middle/a459dcf5tc02869456623&690)
![](http://s13.sinaimg.cn/middle/a459dcf5tc028695c51fc&690)
![](http://s16.sinaimg.cn/middle/a459dcf5tc0286cf0a04f&690)
![](http://s6.sinaimg.cn/middle/a459dcf5tc028692a6e45&690)
17.选择重新生成解决方案.
![](http://s5.sinaimg.cn/middle/a459dcf5t799da49018a4&690)
编译成功后:
![](http://s5.sinaimg.cn/middle/a459dcf5tc0286dfd74e4&690)
到此log4cxx编译就完成了。
分享:
4
![](http://simg.sinajs.cn/blog7style/images/common/sg_trans.gif)
喜欢
0
![](http://simg.sinajs.cn/blog7style/images/common/sg_trans.gif)
赠金笔
1. 下载 log4cxx 以及 apr 和 apr-util源码:
a) http://www.apache.org/dyn/closer.cgi/logging/log4cxx/0.10.0/apache-log4cxx-0.10.0.zip
b) http://archive.apache.org/dist/apr/apr-1.2.11-win32-src.zip
c) http://archive.apache.org/dist/apr/apr-util-1.2.10-win32-src.zip
2. 将 3个压缩包解压到同一个目录.如下图:
3. 将 apr-1.2.11重命名为 apr, 将 apr-util-1.2.10 重命名为apr-util.如下图:
4、打开cmd窗口,如下图所示:
5、在4中输入:cd D:\log4cxx_compile\apache-log4cxx-0.10.0 回车
然后输入:d: 回车后 切换至 apache-log4cxx-0.10.0目录
6、在5中输入:configure.bat 回车
7. 在6的基础下dos窗口下继续输入:configure-aprutil.bat回车
[align=left]8、进入D:\log4cxx_compile\apr-util\include中并找到apu.hw文件,如下图:[/align]
9、用Notepad++打开apu.hw文件(记事本也可以)
手动修改
apr-util\include\apu.hw里的内容
#define APU_HAVE_APR_ICONV1
改为
#define APU_HAVE_APR_ICONV0
10. 使用VS2010打开
apache-log4cxx-0.10.0\projects 下的
log4cxx.dsw
打开工程会提示转换:
11、转换好后工程如下图:
12、将 log4cxx设置为启动项.
设置前:
设置后:
13.开始编译.log4cxx
出现
4>D:\log4cxx_compile\apache-log4cxx-0.10.0\src\main\include\log4cxx/spi/loggingevent.h(155):error C2252: 只能在命名空间范围内显式实例化模板
a) 双击 "输出"窗口中的错误行, 此时会在 "代码窗口" 中出现错误的位置.如下图:
b) 选择 LOG4CXX_LIST_DEF, 按键盘 F12,此时会跳转到该宏的定义,如下图:
c) 将
#define LOG4CXX_LIST_DEF(N, T) \
template class LOG4CXX_EXPORTstd::allocator<T>; \
template class LOG4CXX_EXPORTstd::vector<T>; \
typedef std::vector<T>N
替换为:
#define LOG4CXX_LIST_DEF(N, T) \
typedef std::vector<T>N
14、按照13修改后,重新编译
出现
2>network_io\unix\multicast.c(137): errorC2079: “mip”使用未定义的struct“group_source_req”错误
双击第一行出错输出, 将 136 和 148 行的 #if MCAST_JOIN_SOURCE_GROUP 注释,替换为 #if defined (group_source_req)
15、按照14修改后,重新编译
出现
'4>..\src\main\cpp\stringhelper.cpp(64):error C2039: “insert_iterator”: 不是“std”的成员'等错误.
在该 .cpp中(stringhelper.cpp) 加入头文件#include<iterator>
16、按照15修改后,重新编译
出现 '无法解析的外部符号 xxx'等错误.
将 apr, aprutil, xml添加至 log4cxx 的引用中.(按照下面4副图的顺序操作)
17.选择重新生成解决方案.
编译成功后:
到此log4cxx编译就完成了。
分享:
4
![](http://simg.sinajs.cn/blog7style/images/common/sg_trans.gif)
喜欢
0
![](http://simg.sinajs.cn/blog7style/images/common/sg_trans.gif)
赠金笔
相关文章推荐
- 在vs2010中编译log4cxx-0.10.0详细方法(从下载、编译、解决错误详细介绍)
- 在vs2010中编译log4cxx-0.10.0详细方法(从下载、编译、解决错误详细介绍)
- 在vs2010中编译log4cxx-0.10.0详细方法(从下载、编译、解决错误详细介绍
- 在vs2010中编译log4cxx-0.10.0详细方法(从下载、编译、解决错误详细介绍)(转载)
- 在vs2010中编译log4cxx-0.10.0详细方法(从下载、编译、解决错误详细介绍)
- 在vs2010中编译log4cxx-0.10.0详细方法(从下载、编译、解决错误详细介绍)
- 在vs2010中编译log4cxx-0.10.0详细方法(从下载、编译、解决错误详细介绍)
- 在vs2010中编译log4cxx-0.10.0具体方法(从下载、编译、解决错误具体介绍)
- 在vs2010中编译log4cxx-0.10.0详细方法
- vs2010 项目或者MFC编译错误 转换到coff期间失败的详细解决方法
- 在vs2010中编译log4cxx-0.10.0详细方法
- vs2005-vs2010中编译log4cxx-0.10.0的详细方法
- vs2010编译错误解决方法
- VS2010编译错误 #error : This file requires _WIN32_WINNT to be #defined at least to 0x0403的解决方法
- vs2010打包系统必备选择.net framework 3.5sp1编译错误的解决方法
- NASA World Wind_1.4.0版本在VS2010中编译错误解决方法
- vs2010上进行ACE编程常见编译错误解决方法
- vs2010建立win32 application 编译错误(用vc6.0建立此工程正常运行)解决方法
- vs2010 项目或者MFC编译错误 转换到coff期间失败的详细解决方法
- 下载使用CocoaPods的开源项目时,编译出现错误解决方法