You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4cxx-user@logging.apache.org by Cory Riddell <co...@codeware.com> on 2010/05/11 05:58:53 UTC

Unable to build with VS2010

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

Re: Unable to build with VS2010

Posted by "Daniel L.Andrade" <da...@bol.com.br>.
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


Re: Unable to build with VS2010

Posted by Curt Arnold <ca...@apache.org>.
On May 12, 2010, at 8:23 AM, Julien Marbach wrote:

> Cory,
> I'm having the same probleme here. I have tried to correcte the c2252 errors by moving the declarations at manespace scope in state of class scope but other problems have arised....
> I think my poor knowlege of c++ won't allow me to go further :-(
> 
> Julien
> 


I vaguely remember looking at this with a beta edition of VS 2010 many months ago and it was a trickier problem than I had time for at the moment and never got back to it.  Will try to look at it this evening.

Re: Unable to build with VS2010

Posted by Julien Marbach <ju...@dental-wings.com>.
Cory,
I'm having the same probleme here. I have tried to correcte the c2252 
errors by moving the declarations at manespace scope in state of class 
scope but other problems have arised....
I think my poor knowlege of c++ won't allow me to go further :-(

Julien

Le 2010-05-10 23:58, Cory Riddell a écrit :
> 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
>
>    


-- 
Julien MARBACH
Software Project Manager
+1 514 313 7320
www.Dental-Wings.com