Search code examples
c++visual-studio-2012buildlog4cxx

C2252 Error when building log4cxx


Building in Visual Studio 2012, APR 1.4.8 APR-UTIL 1.5.2 Log4cxx 0.10

ran configure and configure-apr

then open in VS and got 111 C2252 errors (it comes from a macro):

//
//   pointer and list definition macros when building DLL using VC
//
#if defined(_MSC_VER) && !defined(LOG4CXX_STATIC) && defined(LOG4CXX)
#define LOG4CXX_PTR_DEF(T) \
template class LOG4CXX_EXPORT log4cxx::helpers::ObjectPtrT<T>; \
typedef log4cxx::helpers::ObjectPtrT<T> T##Ptr
#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

Any ideas what should I do with this ?


Solution

  • Looks like deleting the 2 lines that starts with "template" solves this.

    remove this:

    template class LOG4CXX_EXPORT std::allocator<T>; \
    template class LOG4CXX_EXPORT std::vector<T>; \