how to build apache log4cxx 0.10 by Visual Studio 201*

本文详细介绍了如何在Visual Studio 201*中配置和构建Log4cxx的过程,包括下载最新版本的Log4cxx及依赖项、安装必要工具如Go或Git、将项目文件转换为VS支持的格式、解决编译过程中出现的定义错误等步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Chapter 1 Official Steps 

We are going to follow the steps here, http://logging.apache.org/log4cxx/building/vstudio.html. However, we must make changes to adapt to Visual Studio 201*.

1. download later version of log4cxx which is apache log4cxx 0.10 from here, http://logging.apache.org/log4cxx/download.html

2. download dependencies from https://archive.apache.org/dist/apr/

3. The official building guideline is quite easy to follow.

1
2
3
4
5
6
7
unzip apr-1.2.11-win32-src.zip
rename apr-1.2.11 apr
unzip apr-util-1.2.10-win32-src.zip
rename apr-util-1.2.10 apr-util
cd apache-log4cxx-0.10.0
configure
configure-aprutil

 

 

4. i recommand you install gow in your developer machine, then you'll have many unix/linux like tools, very convenient. or if you have git, you can add git cmd tools into your env.

configure
configure-aprutil
above 2 cmd requires sed.exe, install it (gow/git) before excute them.
 
Chapter 2 Building Log4cxx 
1. Now we have to convert *.dsw to *.cxproj. To make it smooth, just launch Visual Studio 201* and open log4cxx.dsw.
  VS will ask if you like to convert everything. Simply click Yes.
2.  set log4cxx as startup project.
3. open project log4cxx's properties window, add other 3 projects as references, in here:
  properties -> common properties -> framework and references .
4. hit F7 if you see c2252, this is because LOG4CXX_LIST_DEF define error, go to its definition and change it to 

#define LOG4CXX_LIST_DEF(N, T) typedef std::vector<T> N

 like this,

old:

#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

new:
#define LOG4CXX_LIST_DEF(N, T) typedef std::vector<T> N

5. and u will meet another err about insert_iterator, simply add #include <iterator> to reletive file

6. Done! enjoy your log4cxx!

转载于:https://www.cnblogs.com/scottgu/p/5463794.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值