1. Compiling environment
Windows x64, vs2017
2. Download dependent Apr, Apr-iconv. Apr-util
The new directory is as follows:
C:/work
|_ Apr
|_ Apr-iconv
|_ Apr-util
|_ Log4cxx (any name)
You can download the installation package directly, or you can use SVN to check out the project, SVN check out the address http://apr.apache.org/anonsvn.html
Note: folder name must be called: Apr,apr-iconv,apr-util
Note: Apr and apr-util are checked out to 1.5.x, 1.6.x missing files
+ SVN check out address:
-apr:http://svn.apache.org/repos/asf/apr/apr/branches/1.5.x/
-apr-iconv:http://svn.apache.org/repos/asf/apr/apr-iconv/trunk/
-apr-util:http://svn.apache.org/repos/asf/apr/apr-util/branches/1.5.x/
-Log4cxx Download Address: Https://mirrors.tuna.tsinghua.edu.cn/apache/logging/log4cxx/0.10.0/apache-log4cxx-0.10.0.zip 3. Download sed
Download directory: http://gnuwin32.sourceforge.net/packages/sed.htm Download the Windows version of SED (binaries, and dependent DLLs running) and add sed to system environment variables
Sed-4.2.1-bin.zip
Sed-4.2.1-dep.zip 4. Execute configure.bat in Log4cxx directory, Configure-aprutil.bat 5. Using vs to open log4cxx\projects\ LOG4CXX.DSW 6. The menu "build"-> Configuration Manager adjusts debug and release to 64-bit 7. Menu "Project"-> "Reset Solution Target", 4 projects executed sequentially, and set the Log4cxx to start item 8. Compiling
An error similar to the following occurs when you start compiling:
Src\main\include\log4cxx\spi\loggingevent.h: Error C2252: Template ' error can only be explicitly instantiated within namespace scope.
Workaround: A to double-click the error row in the Output window, where the error occurs in the Code window. b Select Log4cxx_list_def, press keyboard F12, and then jump to definition C of the macro to
#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
To be replaced by:
#define LOG4CXX_LIST_DEF (n, T) \
typedef std::vector<t> N
If you report the following error:
C2039 "Insert_iterator": not a member of "Std"
Solution:
Add to source file header: #include
Note: Log4cxx is not recommended (too cumbersome to compile) and recommended for use with Spdlog