log4cxx vs2017编译

编译流程:

http://mirror.bit.edu.cn/apache/apr/apr-1.6.5-win32-src.zip
http://mirror.bit.edu.cn/apache/apr/apr-util-1.2.10-win32-src.zip
http://mirror.bit.edu.cn/apache/logging/log4cxx/0.10.0/apache-log4cxx-0.10.0.zip

将三个压缩包解压到同一个目录,apr-1.6.5改名为apr,apr-util-1.2.10改名为apr-util

进入apr-util\include修改apr_ldap.hw的APR_HAS_LDAP宏定义为0,apu.hw的APU_HAVE_APR_ICONV宏定义为0

进入apache-log4cxx-0.10.0执行configure.bat,进入projects,打开log4cxx.dsw,升级工程

修改log4cxx.vcxproj文件:AdditionalDependencies最后添加uuid.lib;rpcrt4.lib;

log4cxx\apr\include中添加一个文件:
apr_escape_test_char.h
内容:

/* this file is automatically generated by gen_test_char, do not edit. "make include/private/apr_escape_test_char.h" to regenerate. */
//编译 apr 1.6.5 需要的头文件 apr_escape_test_char.h
#define T_ESCAPE_SHELL_CMD     (1)
#define T_ESCAPE_PATH_SEGMENT  (2)
#define T_OS_ESCAPE_PATH       (4)
#define T_ESCAPE_ECHO          (8)
#define T_ESCAPE_URLENCODED    (16)
#define T_ESCAPE_XML           (32)
#define T_ESCAPE_LDAP_DN       (64)
#define T_ESCAPE_LDAP_FILTER   (128)

static const unsigned char test_char_table[256] = {
    224,222,222,222,222,222,222,222,222,222,223,222,222,223,222,222,222,222,222,222,
    222,222,222,222,222,222,222,222,222,222,222,222,6,16,127,22,17,23,49,17,
    145,145,129,80,80,0,0,18,0,0,0,0,0,0,0,0,0,0,16,87,
    119,16,119,23,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
    0,0,0,0,0,0,0,0,0,0,0,23,223,23,23,0,23,0,0,0,
    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
    0,0,0,23,23,23,17,222,222,222,222,222,222,222,222,222,222,222,222,222,
    222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,
    222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,
    222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,
    222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,
    222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,
    222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222 
};

打开 apr/apr.vcxproj:
删除以下内容:

      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">cl.exe /nologo /W3 /EHsc /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /I ".\include" /Fo.\x64\Debug\gen_test_char /Fe.\x64\Debug\gen_test_char.exe .\tools\gen_test_char.c 
.\x64\Debug\gen_test_char.exe &gt; .\include\apr_escape_test_char.h</Command>
      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Creating gen_test_char.exe and apr_escape_test_char.h</Message>
      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">.\include\apr_escape_test_char.h;.\include\apr_escape_test_char.h;.\include\apr_escape_test_char.h;.\include\apr_escape_test_char.h;%(Outputs)</Outputs>

修改src\main\cpp\stringhelper.cpp文件:
添加

#include <iterator>

修改src\main\include\log4cxx\log4cxx.h文件:

//原来
#if defined(LOG4CXX_STATIC)
#define LOG4CXX_EXPORT
//改为
#if defined(LOG4CXX_STATIC) || (defined(_MSC_VER) && _MSC_VER >= 1900)
#define LOG4CXX_EXPORT
 
//原来
#if defined(_MSC_VER) && !defined(LOG4CXX_STATIC) && defined(LOG4CXX)
//改为
#if defined(_MSC_VER) && _MSC_VER < 1900 && !defined(LOG4CXX_STATIC) && defined(LOG4CXX)
 
//原来
#elif defined(_MSC_VER) && !defined(LOG4CXX_STATIC)
//改为
#elif defined(_MSC_VER) && _MSC_VER < 1900 && !defined(LOG4CXX_STATIC)

传送门:
https://download.csdn.net/download/xie1xiao1jun/10907206

之后dll,lib库,按需求编译吧

问题:1、没有生成lib文件需手动生成def;2、字符集unicode编码;3、网上第一步修改无需要

最后说明:已经做好了一个版本,请用以下地址下载
https://download.csdn.net/download/xie1xiao1jun/10908599

获取更多帮主请关注小程序

个人名片秀

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值