Reference links
http://blog.csdn.net/hnu_zxc/article/details/7786060
Http://blog.chinaunix.net/uid-20384806-id-1954344.html
https://msdn.microsoft.com/en-us/library/aa379205
A compilation environment
Win7 x64 vs2012
Second Download class Library
1 download Apr from http://apr.apache.org/download.cgi, Apr-util,apr-iconv (note: To download the source of the Windows platform)
Apr-1.5.2-win32-src.zip
Apr-util-1.5.4-win32-src.zip
Apr-iconv-1.2.1-win32-src-r2.zip
2 Download from http://logging.apache.org/log4cxx/log4cxx
Apache-log4cxx-0.10.0.zip
3 Download the Windows version of SED from http://gnuwin32.sourceforge.net/packages/sed.htm (binaries, and dependent DLLs that run)
Sed-4.2.1-bin.zip
Sed-4.2.1-dep.zip
Three-Solution compression
1 The second step to download the first two steps of the 4 compressed package to the same folder, the Outer folder name arbitrary, Inner Apr, Apr-util, Apr-iconv This three class library folder needs to be modified to keep only the class library name form, log4cxx this random
The final catalog results are as follows:
D:\log4cpp.compile (this name is arbitrary) \
|_ Apr
|_ Apr-iconv
|_ Apr-util
|_ Log4cxx (this name any)
2 Extract the two compressed packages of SED, merge the same folders in the inner layer, and add the path of Sed.exe to the environment variables of the system.
Quad compilation
1 From the Start menu, enter vs2102 's x64 version of the command-line tool, and then switch to the previous step of the inner log4cxx directory, execute configure.bat in turn, Configure-aprutil.bat for pre-preparation work, if there is no error prompt, Keep looking down, otherwise, check that the steps above are correct
2 Open the Log4cxx\projects directory under the LOG4CXX.DSW, follow the prompts to upgrade the project, but this upgrade has a problem, just upgrade to vs2010 version, so with vs2012 open the project, in Solution Manager, on the solution entry right-click, In the menu that appears, select Upgrade Project so that the project is upgraded to the vs2012 version. (This is a bit unclear, probably so), the following into the formal compilation link (to compile x64 debug version for example)
3 Select the compiled version as shown
Then click the down arrow to the right of x64 and find Log4cxx This project does not configure the x64 version of the compile option
Click the triangle symbol on the right side of the Win32, select New from the menu, press Select
Do not tick "create a new solution platform" before the tick, because the x64 solution platform already has, but this project does not have x64-bit version only, click OK to go back to the Configuration Manager interface, the log4cxx that row of the generation that column of the Tick, and finally began to click on the "Generate" menu, Build the solution.
4
<1> just starting the compilation, an error similar to the following appears:
Apache-log4cxx-0.10.0\src\main\include\log4cxx\spi\loggingevent.h (155): Error C2252: template ' error can only be explicitly instantiated within the namespace scope.
Workaround:
A) 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 jump to the definition of the macro
c) 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
<2> to continue compiling after the change, the following err will appear
This is because you did not import the import library "Rpcrt4.lib" for this function, right-click on the Solution Panel Log4cxx project, select Properties, add in additional dependencies, input, configuration properties, linker , and so on. Rpcrt4.lib ", click OK, continue compiling, you can see the log4cxx.lib and Log4cxx.dll files in the Projects\debug folder
Windows compiler log4cxx (x64)