在Visual中构建,APR 1.4.8 -UTIL 1.5.2 Log4cxx 0.10
运行配置和配置-apr
然后打开VS,得到111个C2252错误(来自宏):
//
// 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
我该怎么处理这个?
发布于 2013-08-21 21:45:42
看起来,删除以"template“开头的2行解决了这个问题。
删除以下内容:
template class LOG4CXX_EXPORT std::allocator<T>; \
template class LOG4CXX_EXPORT std::vector<T>; \
发布于 2014-02-04 10:10:44
看看这个bug报告:LOGCXX-366。
解决办法的总结:
编辑/src/main/cpp/stringhelper.cpp,添加:
#include <iterator>
编辑/src/main/include/log4cxx/log4cxx.hw,删除以下行:
template class LOG4CXX_EXPORT std::allocator<T>; \
template class LOG4CXX_EXPORT std::vector<T>; \
extern template class LOG4CXX_EXPORT std::allocator<T>; \
extern template class LOG4CXX_EXPORT std::vector<T>; \
发布于 2016-04-20 08:29:49
此错误是由于VC++中的一个可以处理的错误造成的。
有关如何在Windows上编译Log4cxx的完整答案,请参阅我在这里的完整答案:https://stackoverflow.com/a/36737721/3637582
https://stackoverflow.com/questions/18365538
复制相似问题