您的位置:首页 > 其它

在vs2010中编译log4cxx-0.10.0详细方法

2016-06-07 14:18 387 查看
3. 将 apr-1.2.11 重命名为 apr, 将 apr-util-1.2.10 重命名为 apr-util.如下图:
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 回车



8、进入D:\log4cxx_compile\apr-util\include中并找到apu.hw文件,如下图:



9、用Notepad++ 打开apu.hw文件(记事本也可以)



手动修改 apr-util\include\apu.hw 里的内容

#define APU_HAVE_APR_ICONV 1

改为

#define APU_HAVE_APR_ICONV 0



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_EXPORT std::allocator<T>; \

template class LOG4CXX_EXPORT std::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): error C2079: “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副图的顺序操作)













到此log4cxx编译就完成了。

提示如下错误:

错误    47      fatal error C1083: 无法打开包括文件:“apr.h”: No such file or directory        e:\test\apache-log4cxx-0.10.0\src\main\cpp\class.cpp    74

可以直接把 /apr/include/apr.h 这个文件改为 apr.h 即可。

同样,还有会提示如下错误的话:

错误    47      fatal error C1083: 无法打开包括文件:“apu.h”: No such file or directory        e:\test\apache-log4cxx-0.10.0\src\main\cpp\class.cpp    74

可以直接把 /apr-util/include/apu.hw 这个文件改为 apu.h



内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: