VS2017编译log4cpp 64bit

参考:https://blog.csdn.net/Wite_Chen/article/details/79078663

源码下载:https://sourceforge.net/projects/log4cpp/files/

1、打开工程log4cpp\msvc10\msvc10.sln,全部升级。

2、如图打开配置增加一行HAVE_SNPRINTF。

 3、修改目标编译平台 release x64

4、开始编译

编译日志:

1>------ ビルド開始: プロジェクト: log4cpp, 構成: Release x64 ------
1>AbortAppender.cpp
1>Appender.cpp
1>AppendersFactory.cpp
1>AppenderSkeleton.cpp
1>BasicConfigurator.cpp
1>c:\users\ema\downloads\compressed\log4cpp\src\basicconfigurator.cpp(29): warning C4996: 'dup': The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _dup. See online help for details.
1>c:\program files (x86)\windows kits\10\include\10.0.17134.0\ucrt\corecrt_io.h(470): note: 'dup' の宣言を確認してください
1>BasicLayout.cpp
1>BufferingAppender.cpp
1>Category.cpp
1>CategoryStream.cpp
1>Configurator.cpp
1>c:\users\ema\downloads\compressed\log4cpp\include\log4cpp\configurator.hh(21): warning C4275: DLL インターフェイスではない class 'std::runtime_error' が DLL インターフェイスのベースになる class 'log4cpp::ConfigureFailure' として使われています。
1>d:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.15.26726\include\stdexcept(157): note: 'std::runtime_error' の宣言を確認してください
1>c:\users\ema\downloads\compressed\log4cpp\include\log4cpp\configurator.hh(21): note: 'log4cpp::ConfigureFailure' の宣言を確認してください
1>DailyRollingFileAppender.cpp
1>c:\users\ema\downloads\compressed\log4cpp\src\dailyrollingfileappender.cpp(76): warning C4996: 'close': The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _close. See online help for details.
1>c:\program files (x86)\windows kits\10\include\10.0.17134.0\ucrt\corecrt_io.h(459): note: 'close' の宣言を確認してください
1>c:\users\ema\downloads\compressed\log4cpp\src\dailyrollingfileappender.cpp(89): warning C4996: 'open': The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _open. See online help for details.
1>c:\program files (x86)\windows kits\10\include\10.0.17134.0\ucrt\corecrt_io.h(516): note: 'open' の宣言を確認してください
1>c:\users\ema\downloads\compressed\log4cpp\src\dailyrollingfileappender.cpp(138): warning C4996: 'unlink': The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _unlink. See online help for details.
1>c:\program files (x86)\windows kits\10\include\10.0.17134.0\ucrt\corecrt_io.h(553): note: 'unlink' の宣言を確認してください
1>DllMain.cpp
1>DummyThreads.cpp
1>FactoryParams.cpp
1>FileAppender.cpp
1>c:\users\ema\downloads\compressed\log4cpp\src\fileappender.cpp(37): warning C4996: 'open': The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _open. See online help for details.
1>c:\program files (x86)\windows kits\10\include\10.0.17134.0\ucrt\corecrt_io.h(516): note: 'open' の宣言を確認してください
1>c:\users\ema\downloads\compressed\log4cpp\src\fileappender.cpp(54): warning C4996: 'close': The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _close. See online help for details.
1>c:\program files (x86)\windows kits\10\include\10.0.17134.0\ucrt\corecrt_io.h(459): note: 'close' の宣言を確認してください
1>c:\users\ema\downloads\compressed\log4cpp\src\fileappender.cpp(81): warning C4267: '引数': 'size_t' から 'unsigned int' に変換しました。データが失われているかもしれません。
1>c:\users\ema\downloads\compressed\log4cpp\src\fileappender.cpp(81): warning C4996: 'write': The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _write. See online help for details.
1>c:\program files (x86)\windows kits\10\include\10.0.17134.0\ucrt\corecrt_io.h(558): note: 'write' の宣言を確認してください
1>c:\users\ema\downloads\compressed\log4cpp\src\fileappender.cpp(88): warning C4996: 'open': The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _open. See online help for details.
1>c:\program files (x86)\windows kits\10\include\10.0.17134.0\ucrt\corecrt_io.h(516): note: 'open' の宣言を確認してください
1>c:\users\ema\downloads\compressed\log4cpp\src\fileappender.cpp(93): warning C4996: 'close': The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _close. See online help for details.
1>c:\program files (x86)\windows kits\10\include\10.0.17134.0\ucrt\corecrt_io.h(459): note: 'close' の宣言を確認してください
1>Filter.cpp
1>FixedContextCategory.cpp
1>HierarchyMaintainer.cpp
1>IdsaAppender.cpp
1>LayoutAppender.cpp
1>コードを生成中...
1>コンパイル中...
1>LayoutsFactory.cpp
1>LevelEvaluator.cpp
1>Localtime.cpp
1>LoggingEvent.cpp
1>Manipulator.cpp
1>MSThreads.cpp
1>c:\users\ema\downloads\compressed\log4cpp\src\msthreads.cpp(17): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>c:\program files (x86)\windows kits\10\include\10.0.17134.0\ucrt\stdio.h(1774): note: 'sprintf' の宣言を確認してください
1>NDC.cpp
1>NTEventLogAppender.cpp
1>OmniThreads.cpp
1>OstreamAppender.cpp
1>PassThroughLayout.cpp
1>PatternLayout.cpp
1>c:\users\ema\downloads\compressed\log4cpp\include\log4cpp\configurator.hh(21): warning C4275: DLL インターフェイスではない class 'std::runtime_error' が DLL インターフェイスのベースになる class 'log4cpp::ConfigureFailure' として使われています。
1>d:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.15.26726\include\stdexcept(157): note: 'std::runtime_error' の宣言を確認してください
1>c:\users\ema\downloads\compressed\log4cpp\include\log4cpp\configurator.hh(21): note: 'log4cpp::ConfigureFailure' の宣言を確認してください
1>c:\users\ema\downloads\compressed\log4cpp\src\patternlayout.cpp(377): warning C4267: '=': 'size_t' から 'int' に変換しました。データが失われているかもしれません。
1>PortabilityImpl.cpp
1>Priority.cpp
1>Properties.cpp
1>c:\users\ema\downloads\compressed\log4cpp\src\properties.cpp(138): warning C4996: 'getenv': This function or variable may be unsafe. Consider using _dupenv_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>c:\program files (x86)\windows kits\10\include\10.0.17134.0\ucrt\stdlib.h(1191): note: 'getenv' の宣言を確認してください
1>PropertyConfigurator.cpp
1>c:\users\ema\downloads\compressed\log4cpp\include\log4cpp\configurator.hh(21): warning C4275: DLL インターフェイスではない class 'std::runtime_error' が DLL インターフェイスのベースになる class 'log4cpp::ConfigureFailure' として使われています。
1>d:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.15.26726\include\stdexcept(157): note: 'std::runtime_error' の宣言を確認してください
1>c:\users\ema\downloads\compressed\log4cpp\include\log4cpp\configurator.hh(21): note: 'log4cpp::ConfigureFailure' の宣言を確認してください
1>PropertyConfiguratorImpl.cpp
1>c:\users\ema\downloads\compressed\log4cpp\include\log4cpp\configurator.hh(21): warning C4275: DLL インターフェイスではない class 'std::runtime_error' が DLL インターフェイスのベースになる class 'log4cpp::ConfigureFailure' として使われています。
1>d:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.15.26726\include\stdexcept(157): note: 'std::runtime_error' の宣言を確認してください
1>c:\users\ema\downloads\compressed\log4cpp\include\log4cpp\configurator.hh(21): note: 'log4cpp::ConfigureFailure' の宣言を確認してください
1>PThreads.cpp
1>RemoteSyslogAppender.cpp
1>c:\users\ema\downloads\compressed\log4cpp\src\remotesyslogappender.cpp(86): warning C4996: 'gethostbyname': Use getaddrinfo() or GetAddrInfoW() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings
1>c:\program files (x86)\windows kits\10\include\10.0.17134.0\um\winsock2.h(2218): note: 'gethostbyname' の宣言を確認してください
1>c:\users\ema\downloads\compressed\log4cpp\src\remotesyslogappender.cpp(98): warning C4996: 'gethostbyname': Use getaddrinfo() or GetAddrInfoW() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings
1>c:\program files (x86)\windows kits\10\include\10.0.17134.0\um\winsock2.h(2218): note: 'gethostbyname' の宣言を確認してください
1>c:\users\ema\downloads\compressed\log4cpp\src\remotesyslogappender.cpp(107): warning C4996: 'inet_addr': Use inet_pton() or InetPton() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings
1>c:\program files (x86)\windows kits\10\include\10.0.17134.0\um\winsock2.h(1830): note: 'inet_addr' の宣言を確認してください
1>c:\users\ema\downloads\compressed\log4cpp\src\remotesyslogappender.cpp(108): warning C4996: 'gethostbyaddr': Use getnameinfo() or GetNameInfoW() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings
1>c:\program files (x86)\windows kits\10\include\10.0.17134.0\um\winsock2.h(2196): note: 'gethostbyaddr' の宣言を確認してください
1>c:\users\ema\downloads\compressed\log4cpp\src\remotesyslogappender.cpp(164): warning C4267: '引数': 'size_t' から 'int' に変換しました。データが失われているかもしれません。
1>c:\users\ema\downloads\compressed\log4cpp\src\remotesyslogappender.cpp(146): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>c:\program files (x86)\windows kits\10\include\10.0.17134.0\ucrt\stdio.h(1774): note: 'sprintf' の宣言を確認してください
1>RollingFileAppender.cpp
1>c:\users\ema\downloads\compressed\log4cpp\src\rollingfileappender.cpp(40): warning C4244: '初期化中': 'float' から 'unsigned short' への変換です。データが失われる可能性があります。
1>c:\users\ema\downloads\compressed\log4cpp\src\rollingfileappender.cpp(46): warning C4244: '=': 'float' から 'unsigned short' への変換です。データが失われる可能性があります。
1>c:\users\ema\downloads\compressed\log4cpp\src\rollingfileappender.cpp(62): warning C4996: 'close': The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _close. See online help for details.
1>c:\program files (x86)\windows kits\10\include\10.0.17134.0\ucrt\corecrt_io.h(459): note: 'close' の宣言を確認してください
1>c:\users\ema\downloads\compressed\log4cpp\src\rollingfileappender.cpp(81): warning C4996: 'open': The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _open. See online help for details.
1>c:\program files (x86)\windows kits\10\include\10.0.17134.0\ucrt\corecrt_io.h(516): note: 'open' の宣言を確認してください
1>c:\users\ema\downloads\compressed\log4cpp\src\rollingfileappender.cpp(86): warning C4996: 'lseek': The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _lseek. See online help for details.
1>c:\program files (x86)\windows kits\10\include\10.0.17134.0\ucrt\corecrt_io.h(503): note: 'lseek' の宣言を確認してください
1>コードを生成中...
1>コンパイル中...
1>SimpleConfigurator.cpp
1>c:\users\ema\downloads\compressed\log4cpp\include\log4cpp\configurator.hh(21): warning C4275: DLL インターフェイスではない class 'std::runtime_error' が DLL インターフェイスのベースになる class 'log4cpp::ConfigureFailure' として使われています。
1>d:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.15.26726\include\stdexcept(157): note: 'std::runtime_error' の宣言を確認してください
1>c:\users\ema\downloads\compressed\log4cpp\include\log4cpp\configurator.hh(21): note: 'log4cpp::ConfigureFailure' の宣言を確認してください
1>c:\users\ema\downloads\compressed\log4cpp\src\simpleconfigurator.cpp(123): warning C4996: 'dup': The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _dup. See online help for details.
1>c:\program files (x86)\windows kits\10\include\10.0.17134.0\ucrt\corecrt_io.h(470): note: 'dup' の宣言を確認してください
1>c:\users\ema\downloads\compressed\log4cpp\src\simpleconfigurator.cpp(127): warning C4996: 'dup': The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _dup. See online help for details.
1>c:\program files (x86)\windows kits\10\include\10.0.17134.0\ucrt\corecrt_io.h(470): note: 'dup' の宣言を確認してください
1>SimpleLayout.cpp
1>SmtpAppender.cpp
1>StringQueueAppender.cpp
1>StringUtil.cpp
1>c:\users\ema\downloads\compressed\log4cpp\src\stringutil.cpp(50): warning C4996: '_vsnprintf': This function or variable may be unsafe. Consider using _vsnprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>c:\program files (x86)\windows kits\10\include\10.0.17134.0\ucrt\stdio.h(1400): note: '_vsnprintf' の宣言を確認してください
1>SyslogAppender.cpp
1>TimeStamp.cpp
1>c:\users\ema\downloads\compressed\log4cpp\src\timestamp.cpp(38): warning C4244: '=': 'time_t' から 'int' への変換です。データが失われる可能性があります。
1>TriggeringEventEvaluatorFactory.cpp
1>Win32DebugAppender.cpp
1>コードを生成中...
1>snprintf.c
1>   ライブラリ C:\Users\ema\Downloads\Compressed\log4cpp\msvc10\x64\Release\log4cpp.lib とオブジェクト C:\Users\ema\Downloads\Compressed\log4cpp\msvc10\x64\Release\log4cpp.exp を作成中
1>log4cpp.vcxproj -> C:\Users\ema\Downloads\Compressed\log4cpp\msvc10\x64\Release\log4cpp.dll
1>プロジェクト "log4cpp.vcxproj" のビルドが終了しました。
========== ビルド: 1 正常終了、0 失敗、0 更新不要、0 スキップ ==========

从日志可以看到生成的库在log4cpp\msvc10\x64\Release目录下面。

 编译结果:https://download.csdn.net/download/mccoy39082/10699754

猜你喜欢

转载自blog.csdn.net/mccoy39082/article/details/82924400