I do not think this interest many. Me myself may not come back to this again. I found it not work with my Qt app, at least as is, and so have gone to “a blend of” Log4Qt. But I spent an entire day for this, so want to leave the log somewhere...
Anyway, first of all, what is Log4cxx?
It is the C++ port of the famous Log4J. I have been using Log4Net (Not J ), so wondered if there is the same for my C++ app.
The official instruction for the build can be found here. But apparently many are having difficulties in doing it. Google “log4cxx visual studio” and you wiil see.
Let us start with downloading the required packages. # By the way, I have never succeeded in the signature checking... But no time for it now.
For apr and apr-util, newer exist. But the util package does not contain the xml VC project referenced by the main log4cxx solution. So I sticked to their versions of the instruction.
Building apr failed. This blog post How To Build Log4cxx In Visual Studio 2010 helped.
It reads: If apr fails, and you find out _WIN32_WINNT is less than _WIN32_WINNT_WINXP, ...
This was too cryptic to me at the beginning.
_WIN32_WINNT is defined as follows in the project.
#define _WIN32_WINNT 0x0400
_WIN32_WINNT_WINXP is said defined as 0x0501 in the Windows header files. ref. Using the Windows Headers
So I added the precprocessor definition as instructed.
Proceed to builing the main log4cxx project, and have tons of compile errors just as predicted by the blog post.
However, for VS2015, the solution appears not the one presented there, but the same for 2012 instead.
Thanks GOD. Now the number of compile error comes down to only one, which is removed by adding #include <iterator> in stringhelper.cpp.
Finally, there are a handful of linkage error to resolve. It says here that it has started with VS2013, Gorsh!. How to take out the function casts is detailed here.
Thanks GOD! I have got the DLL and confirmed that it works with a test win32 console app, but not my actual Qt app...
No comments:
Post a Comment