Cory Riddell <cory <at> codeware.com> writes: > > I just installed VS2010 and I'm trying to recompile log4cxx. So far, I > haven't gotten very far. I've previously been able to build on VS2005 > without any problems. > > I downloaded apache-log4cxx-0.10.0.zip, apr-1.4.2-win32-src.zip and > apr-util-1.3.9-win32.zip. Unzipped them all, renamed the apr and > apr-util directories. Ran configure.bat and configure-aprutil.bat > successfully. Loaded projects/log4cxx.dsw. VisualStudio 2010 converted > the project into a solution and I set the active project to log4cxx and > started to build. > > The apr, aprutil and xml projects all seem to build successfully. The > log4cxx project gives me a seemingly endless stream of errors: > 4> appenderattachableimpl.cpp > 4>C:\dev\ExtLibs\apache\apache-log4cxx-0.10.0 \src\main\include\log4cxx/spi/loggingevent.h(155): > error C2252: an explicit instantiation of a template can only occur at > namespace scope > 4>C:\dev\ExtLibs\apache\apache-log4cxx-0.10.0 \src\main\include\log4cxx/spi/loggingevent.h(155): > error C2252: an explicit instantiation of a template can only occur at > namespace scope > 4> appenderskeleton.cpp > 4>C:\dev\ExtLibs\apache\apache-log4cxx-0.10.0 \src\main\include\log4cxx/spi/loggingevent.h(155): > error C2252: an explicit instantiation of a template can only occur at > namespace scope > 4>C:\dev\ExtLibs\apache\apache-log4cxx-0.10.0 \src\main\include\log4cxx/spi/loggingevent.h(155): > error C2252: an explicit instantiation of a template can only occur at > namespace scope > > and this goes on for a long time with similar errors happening in other > files as well. > > loggingevent.h line 155 is: > LOG4CXX_LIST_DEF(KeySet, LogString); > > Has anybody else compiled successfully with VS2010? Any clues as to what > the compiler is complaining about? > > Thanks, > cory > >
Hi Cory, This is how I did it: 1. Move all those LOG4CXX_LIST_DEF macros before the class definition. in telnetappender.h you will also need to move the typedef that precedes this macro. 2. If the compiler complains about KeySet not being member of LoggingEvent, just remove the scope (since we moved the type to outside the class in the previous step, these types no longer are inside the class) ex: change: LoggingEvent::KeySet set; to: KeySet set; 3. If the compiler complains about insert_iterator not being in the namespace std, add #include <iterator> to the include section of the source file 4. For some reason the VS2010 converter 'forgot' to reference the lib files from apr,apr-util and xml, so i had to add them manually. Hope it helps, Daniel