gpt4 book ai didi

visual-studio-2013 - 在 visual studio 2013 下构建 log4cxx

转载 作者:行者123 更新时间:2023-12-04 02:04:56 26 4
gpt4 key购买 nike

我正在尝试在 Visual Studio 2013 下构建 log4cxx 版本 0.10.0。我已经完成了 building log4cxx in vs 2010 c++ 中指定的所有修复。 .

但是,当尝试创建 log4cxx.lib 时,它现在在链接阶段失败,并出现以下错误:

unresolved external symbol __InterlockedIncrement referenced in function _apr_atomic_inc32@4
unresolved external symbol __InterlockedExchangeAdd referenced in function _apr_atomic_add32@8
unresolved external symbol __InterlockedExchange referenced in function _apr_atomic_set32@8
unresolved external symbol __InterlockedDecrement referenced in function _apr_atomic_dec32@4
unresolved external symbol __InterlockedCompareExchange referenced in function _apr_atomic_cas32@12

根据 MSDN,这些函数应该在 kernel32.lib 中,我已将其添加到链接器中,但没有效果。查看 ht elib,这似乎包含 _InterlockedIncrement(单下划线)和 _imp_InterlockedIncrement

有谁知道我可以做些什么来让它工作?

此外,Building log4cxx with VS 2012 on Windows 7 中建议的修复没有什么不同

最佳答案

以下过程是在 VS2013 下构建 Log4CXX 的完整过程,适用于 32 位和 64 位构建。请注意,32 位版本已经过非常简单的测试,而 64 位版本已经过稍微广泛的测试(即,这是我们正在使用的版本)。

  1. 下载 apache-log4cxx-0.10.0.zipapr-x.y.z-win32.src.zipapr-util-1.5.4-win32 .src.zip,其中xyz为最新版本。
  2. 将内容提取到共享目录。
  3. 重命名 apr-x.y.zapr-utls-x.y.z 以删除版本号。
  4. 将补丁应用于 log4cxx 中的文件。见下文。
  5. 对于 32 位版本,补丁 apr\atomic\win32\apr_atomic.c

    1. 替换所有 defined(_M_IA64) ||已定义(_M_AMD64))已定义(_M_IA64) ||定义(_M_AMD64)|| (_MSC_VER == 1800))

      这实际上只是一个临时修复,但它确实有效。

  6. 运行 apache-log4cxx-0.10.0\configure.bat
  7. 补丁 apr-util
    1. include\apu.hw中,将APU_HAVE_APR_ICONV定义为0。
    2. include\apr_ldap.hw 中,将 APR_HAS_LDAP 定义为 0。
  8. apache-log4cxx-0.10.0\projects\log4cxx.dsw 加载到 Visual Studio 2013 中。系统将提示您升级项目。接受并等待转换完成。这将创建 log4cxx.sln,您应该在下次打开项目时使用它
  9. 选择菜单选项 Build->Configuration Manager。为 log4cxx 创建 x64 项目上下文,包括发布和调试。检查这些项目的构建框。
  10. 根据需要升级项目。上一步将导致所有其他项目都需要这样做。右键单击解决方案资源管理器中的项目,然后选择Upgrade VC++ compiler ...
  11. 如果您希望您的调试库具有与发布不同的文件名,请右键单击 log4cxx 项目,然后选择 properties
    1. 选择调试/所有平台配置设置。
    2. Configuration Properties/General/Target name 设置为将“_d”作为文件名的结尾。
    3. 设置 Linker/All Options/Output File 以“_d”作为文件名的结尾。
    4. 设置 Linker/All Options/Import Library 将“_d”作为文件名的结尾。
  12. 在菜单 Build -> Configuration manager 中选择适当的事件解决方案配置和平台。
  13. 构建项目。

下面是log4cxx所需的补丁。

diff -r .\archives\apache-log4cxx-0.10.0/src/main/cpp/loggingevent.cpp .\build_official_2\apache-log4cxx-0.10.0/src/main/cpp/loggingevent.cpp
127c127
< LoggingEvent::KeySet LoggingEvent::getMDCKeySet() const
---
> KeySet LoggingEvent::getMDCKeySet() const
129c129
< LoggingEvent::KeySet set;
---
> KeySet set;
188c188
< LoggingEvent::KeySet LoggingEvent::getPropertyKeySet() const
---
> KeySet LoggingEvent::getPropertyKeySet() const
190c190
< LoggingEvent::KeySet set;
---
> KeySet set;
diff -r .\archives\apache-log4cxx-0.10.0/src/main/cpp/propertiespatternconverter.cpp .\build_official_2\apache-log4cxx-0.10.0/src/main/cpp/propertiespatternconverter.cpp
62c62
< LoggingEvent::KeySet keySet(event->getMDCKeySet());
---
> KeySet keySet(event->getMDCKeySet());
64c64
< for(LoggingEvent::KeySet::const_iterator iter = keySet.begin();
---
> for(KeySet::const_iterator iter = keySet.begin();
diff -r .\archives\apache-log4cxx-0.10.0/src/main/cpp/xmllayout.cpp .\build_official_2\apache-log4cxx-0.10.0/src/main/cpp/xmllayout.cpp
104,105c104,105
< LoggingEvent::KeySet propertySet(event->getPropertyKeySet());
< LoggingEvent::KeySet keySet(event->getMDCKeySet());
---
> KeySet propertySet(event->getPropertyKeySet());
> KeySet keySet(event->getMDCKeySet());
109c109
< for (LoggingEvent::KeySet::const_iterator i = keySet.begin();
---
> for (KeySet::const_iterator i = keySet.begin();
123c123
< for (LoggingEvent::KeySet::const_iterator i2 = propertySet.begin();
---
> for (KeySet::const_iterator i2 = propertySet.begin();
diff -r .\archives\apache-log4cxx-0.10.0/src/main/include/log4cxx/asyncappender.h .\build_official_2\apache-log4cxx-0.10.0/src/main/include/log4cxx/asyncappender.h
52a53
> LOG4CXX_LIST_DEF(LoggingEventList, log4cxx::spi::LoggingEventPtr);
197c198
< LOG4CXX_LIST_DEF(LoggingEventList, log4cxx::spi::LoggingEventPtr);
---
>
diff -r .\archives\apache-log4cxx-0.10.0/src/main/include/log4cxx/helpers/bytearrayinputstream.h .\build_official_2\apache-log4cxx-0.10.0/src/main/include/log4cxx/helpers/bytearrayinputstream.h
38a39
> LOG4CXX_LIST_DEF(ByteList, unsigned char);
42c43
< LOG4CXX_LIST_DEF(ByteList, unsigned char);
---
>
diff -r .\archives\apache-log4cxx-0.10.0/src/main/include/log4cxx/helpers/bytearrayoutputstream.h .\build_official_2\apache-log4cxx-0.10.0/src/main/include/log4cxx/helpers/bytearrayoutputstream.h
40a41
> LOG4CXX_LIST_DEF(ByteList, unsigned char);
44c45
< LOG4CXX_LIST_DEF(ByteList, unsigned char);
---
>
diff -r .\archives\apache-log4cxx-0.10.0/src/main/include/log4cxx/helpers/simpledateformat.h .\build_official_2\apache-log4cxx-0.10.0/src/main/include/log4cxx/helpers/simpledateformat.h
45a46
> LOG4CXX_LIST_DEF(PatternTokenList, log4cxx::helpers::SimpleDateFormatImpl::PatternToken*);
78c79
< LOG4CXX_LIST_DEF(PatternTokenList, log4cxx::helpers::SimpleDateFormatImpl::PatternToken*);
---
>
diff -r .\archives\apache-log4cxx-0.10.0/src/main/include/log4cxx/helpers/socketoutputstream.h .\build_official_2\apache-log4cxx-0.10.0/src/main/include/log4cxx/helpers/socketoutputstream.h
35c35
<
---
> LOG4CXX_LIST_DEF(ByteList, unsigned char);
53c53
< LOG4CXX_LIST_DEF(ByteList, unsigned char);
---
>

diff -r .\archives\apache-log4cxx-0.10.0/src/main/include/log4cxx/net/sockethubappender.h .\build_official_2\apache-log4cxx-0.10.0/src/main/include/log4cxx/net/sockethubappender.h
105c105
<
---
> LOG4CXX_LIST_DEF(ObjectOutputStreamList, log4cxx::helpers::ObjectOutputStreamPtr);
115c115
< LOG4CXX_LIST_DEF(ObjectOutputStreamList, log4cxx::helpers::ObjectOutputStreamPtr);
---
>
diff -r .\archives\apache-log4cxx-0.10.0/src/main/include/log4cxx/net/telnetappender.h .\build_official_2\apache-log4cxx-0.10.0/src/main/include/log4cxx/net/telnetappender.h
67c67,69
< class LOG4CXX_EXPORT TelnetAppender : public AppenderSkeleton
---
> typedef log4cxx::helpers::SocketPtr Connection;
> LOG4CXX_LIST_DEF(ConnectionList, Connection);
> class LOG4CXX_EXPORT TelnetAppender : public AppenderSkeleton
134,135d135
< typedef log4cxx::helpers::SocketPtr Connection;
< LOG4CXX_LIST_DEF(ConnectionList, Connection);
diff -r .\archives\apache-log4cxx-0.10.0/src/main/include/log4cxx/patternlayout.h .\build_official_2\apache-log4cxx-0.10.0/src/main/include/log4cxx/patternlayout.h
326a327,328
> LOG4CXX_LIST_DEF(LoggingEventPatternConverterList, log4cxx::pattern::LoggingEventPatternConverterPtr);
> LOG4CXX_LIST_DEF(FormattingInfoList, log4cxx::pattern::FormattingInfoPtr);
337c339
< LOG4CXX_LIST_DEF(LoggingEventPatternConverterList, log4cxx::pattern::LoggingEventPatternConverterPtr);
---
>
343c345
< LOG4CXX_LIST_DEF(FormattingInfoList, log4cxx::pattern::FormattingInfoPtr);
---
>

diff -r .\archives\apache-log4cxx-0.10.0/src/main/include/log4cxx/rolling/rollingpolicybase.h .\build_official_2\apache-log4cxx-0.10.0/src/main/include/log4cxx/rolling/rollingpolicybase.h
44a45,46
> LOG4CXX_LIST_DEF(PatternConverterList, log4cxx::pattern::PatternConverterPtr);
> LOG4CXX_LIST_DEF(FormattingInfoList, log4cxx::pattern::FormattingInfoPtr);
60c62
< LOG4CXX_LIST_DEF(PatternConverterList, log4cxx::pattern::PatternConverterPtr);
---
>
66c68
< LOG4CXX_LIST_DEF(FormattingInfoList, log4cxx::pattern::FormattingInfoPtr);
---
>
diff -r .\archives\apache-log4cxx-0.10.0/src/main/include/log4cxx/spi/loggingevent.h .\build_official_2\apache-log4cxx-0.10.0/src/main/include/log4cxx/spi/loggingevent.h
54a55
> LOG4CXX_LIST_DEF(KeySet, LogString);
155c156
< LOG4CXX_LIST_DEF(KeySet, LogString);
---
>

关于visual-studio-2013 - 在 visual studio 2013 下构建 log4cxx,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26612338/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com