编译log4cplus-2.0.x备忘录

本文提供了一份详细的指南,介绍如何在Windows和Linux环境下使用CMake工具和Visual Studio编译log4plus日志库。包括解决常见问题,如配置选项、预处理器定义、依赖项管理等。

---- 编译catch----
注意:此步不是必须的
1:先安装python
2:用cmake工具编译catch,注意:必须选择cmake gui中的file->delete cache菜单,
     之后单击“configure”按钮,在弹出的编译器如:vs2017中一定得选x64或x86(依据你的需求决定)


-----windows 下 编译log4plus-----
1:先从git下载log4plus源码(https://github.com/log4cplus/log4cplus/tree/2.0.x),注意:有时下载下来的源码中没有catch、ThreadPool
     ,而git中是有的,重新到刚才log4plus源码的链接地址单独下载catch、ThreadPool,放到log4plus目录,
      注意必须和git中的目录一致,ThreadPool.h fangzai /media/dansir/新加卷/work20200331/SoftWareAbout/Thirdpart/log4cplus-2.0.x/src  
2:   用vs打开msvc14\log4cplus.sln
3:   将catch中的所有头文件加入到CLFSAppender工程中(或者你不嫌麻烦,每个工程中都加入也行),并在每个你要编译的工程中的属性->C/C++->预处理器->预处理器定义
     中加入CATCH_CONFIG_WCHAR 、UNICODE、WIN32(或者你不嫌麻烦,每个工程中都加入也行),
     如果不加上面几个预编译项,则会报:
    
       : error C2511: “int Catch::Session::applyCommandLine(int,const wchar_t *const *)”:“Catch::Session”中没有找到重载的成员函数
       error C2352: “Catch::Session::applyCommandLine”: 非静态成员函数的非法调用
4:编译所有工程


-----linux下 编译log4plus共享库-----
1:先从git下载log4plus源码(https://github.com/log4cplus/log4cplus/tree/2.0.x),注意:有时下载下来的源码中没有catch、ThreadPool
     ,而git中是有的,重新到刚才log4plus源码的链接地址单独下载catch、ThreadPool,放到log4plus目录,
      注意必须和git中的目录一致,ThreadPool.h放到   Thirdpart/log4cplus-2.0.x/src  目录下,否则会报找不到ThreadPool.h文件错误
2: sudo ./configure

如果报:command not found,执行chmod +x configure,然后再执行上面的命令
3:  make
4: sudo make install

-----linux下 编译log4plus静态库-----

 其它步骤和编译log4plus共享库相同,第二步应改为:
./configure --enable-static


                            
 

优化这段代码逻辑 if (s32Index == 0) { for (BU_U8 *pu8YStart = pu8YPlane; pu8YStart + 3 < pu8YEnd;) { s32X = s32YIndex % s32Width; s32Y = s32YIndex / s32Width; if (s32X >= 0 && s32X <= (s32Width / 2)) { pu8YStart[0] = 16; pu8YStart[1] = 16; pu8YStart[2] = 16; pu8YStart[3] = 16; pu8YStart += 4; s32YIndex += 4; } else if (s32X > (s32Width / 2) && s32X <= s32Width) { pu8YStart[0] += (s32Width - s32X); s32YIndex += (s32Width - s32X); } } for (BU_U8 *pu8UvStart = pu8UvPlane; pu8UvStart + 3 < pu8UvEnd;) { s32X = s32UvIndex % s32Width; s32Y = s32UvIndex / s32Width * 2; if (s32X >= 0 && s32X <= (s32Width / 2)) { pu8UvStart[0] = 128; pu8UvStart[1] = 128; pu8UvStart[2] = 128; pu8UvStart[3] = 128; pu8UvStart += 4; s32UvIndex += 4; } else if (s32X > (s32Width / 2) && s32X <= s32Width) { pu8UvStart[0] += (s32Width - s32X); s32UvIndex += (s32Width - s32X); } } } else { for (BU_U8 *pu8YStart = pu8YPlane; pu8YStart + 3 < pu8YEnd;) { s32X = s32YIndex % s32Width; s32Y = s32YIndex / s32Width; if (s32X >= (s32Width / 2) && s32X <= s32Width) { pu8YStart[0] = 16; pu8YStart[1] = 16; pu8YStart[2] = 16; pu8YStart[3] = 16; pu8YStart += 4; s32YIndex += 4; } else if (s32X > 0 && s32X < (s32Width / 2)) { pu8YStart[0] += (s32Width / 2 - s32X); s32YIndex += (s32Width / 2 - s32X); } } for (BU_U8 *pu8UvStart = pu8UvPlane; pu8UvStart + 3 < pu8UvEnd;) { s32X = s32UvIndex % s32Width; s32Y = s32UvIndex / s32Width * 2; if (s32X >= (s32Width / 2) && s32X <= s32Width) { pu8UvStart[0] = 128; pu8UvStart[1] = 128; pu8UvStart[2] = 128; pu8UvStart[3] = 128; pu8UvStart += 4; s32UvIndex += 4; } else if (s32X > 0 && s32X < (s32Width / 2)){ pu8UvStart[0] += (s32Width - s32X); s32UvIndex += (s32Width - s32X); } } }
06-17
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值