[ https://issues.apache.org/jira/browse/LOGCXX-533?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Robert Middleton closed LOGCXX-533. ----------------------------------- Resolution: Resolved > cannot use log4cxx header files with clang++ > -------------------------------------------- > > Key: LOGCXX-533 > URL: https://issues.apache.org/jira/browse/LOGCXX-533 > Project: Log4cxx > Issue Type: Bug > Components: Core > Affects Versions: 0.11.0 > Environment: Windows 10/ Visual Studio 2019/clang++ > Reporter: Sergei Delov > Priority: Major > Fix For: 0.11.0 > > > I initially reported the problem for vcpkg log4cxx package: > [https://github.com/microsoft/vcpkg/issues/19730] > Here's the report text: > --- > [log4cxx] failure to compile application with clang on Windows/VC2019 > We have an application that uses log4cxx. > When I compile with clang on Windows VC2019 I observe the following error: > _[...]_ > _In file included from > C:\vcpkg\installed\x64-windows\include\log4cxx/logger.h:30:_ > _In file included from > C:\vcpkg\installed\x64-windows\include\log4cxx/helpers/appenderattachableimpl.h:27:_ > _In file included from > C:\vcpkg\installed\x64-windows\include\log4cxx/spi/appenderattachable.h:30:_ > _C:\vcpkg\installed\x64-windows\include\log4cxx\appender.h(140,1): error : > explicit instantiation of 'allocator' not in a namespace enclosing 'std'_ > _LOG4CXX_LIST_DEF(AppenderList, AppenderPtr);_ > _^_ > _C:\vcpkg\installed\x64-windows\include\log4cxx\log4cxx.h(91,45): note: > expanded from macro 'LOG4CXX_LIST_DEF'_ > _extern template class LOG4CXX_EXPORT std::allocator;_ > _^_ > _C:\Program Files (x86)\Microsoft Visual > Studio\2019\Professional\VC\Tools\MSVC\14.27.29110\include\iosfwd(167,7): > note: explicit instantiation refers here_ > _class allocator;_ > _^_ > I found this error appears because clang compiler included with Visual Studio > has _MSC_VER macro defined. > (Intel icx compiler also has _MSC_VER macro defined on Windows) > The simple fix worked for me for both compilers: > (log4cxx.h, line 81) > {code:java} > #elif defined(_MSC_VER) && !defined(__clang__) && > !defined(LOG4CXX_STATIC){code} > I didn't try to compile with LOG4CXX_STATIC defined, though. > --- > vcpkg folks recommended to address "upstream" team. -- This message was sent by Atlassian Jira (v8.3.4#803005)