gpt4 book ai didi

c++ - 使用 __stdcall 和 Boost 1.47.0 编译错误 log4cxx

转载 作者:行者123 更新时间:2023-11-28 08:14:55 24 4
gpt4 key购买 nike

如果你能帮上忙,我会很高兴。

我的IDE是VS2010。

我正在使用 boost 1.47.0,尤其是 boost::asio。

经过几天的开发,我决定添加 log4cxx。

log4cxx 需要将调用约定更改为 __stdcall

我出乎意料地遇到了很多编译错误。它们大约有 70 个错误。

我用谷歌搜索了一下,发现了这些:

#define BOOST_BIND_ENABLE_STDCALL 
#define BOOST_MEM_FN_ENABLE_STDCALL

有帮助。现在只有大约 10 个错误。这里有:

1>ClCompile:
1> main.cpp
1>D:\Development\lib\boost_1_47_0\boost/detail/interlocked.hpp(61): error C2373: '_InterlockedCompareExchange' : redefinition; different type modifiers
1> C:\Program Files\Microsoft Visual Studio 10.0\VC\include\intrin.h(214) : see declaration of '_InterlockedCompareExchange'
1>D:\Development\lib\boost_1_47_0\boost/detail/interlocked.hpp(62): error C2373: '_InterlockedExchange' : redefinition; different type modifiers
1> C:\Program Files\Microsoft Visual Studio 10.0\VC\include\intrin.h(192) : see declaration of '_InterlockedExchange'
1>D:\Development\lib\boost_1_47_0\boost/detail/interlocked.hpp(63): error C2373: '_InterlockedExchangeAdd' : redefinition; different type modifiers
1> C:\Program Files\Microsoft Visual Studio 10.0\VC\include\intrin.h(204) : see declaration of '_InterlockedExchangeAdd'
1>D:\Development\lib\boost_1_47_0\boost/smart_ptr/detail/sp_counted_base_w32.hpp(92): error C2446: '==' : no conversion from 'long' to 'long (__stdcall *)(volatile long *,long,long)'
1> Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
1>D:\Development\lib\boost_1_47_0\boost/smart_ptr/detail/sp_counted_base_w32.hpp(92): error C2040: '==' : 'long (__stdcall *)(volatile long *,long,long)' differs in levels of indirection from 'long'
1>D:\Development\lib\boost_1_47_0\boost/smart_ptr/detail/sp_counted_base_w32.hpp(92): error C3861: '_InterlockedCompareExchange': identifier not found
1>D:\Development\lib\boost_1_47_0\boost/smart_ptr/detail/spinlock_w32.hpp(62): error C3861: '_InterlockedExchange': identifier not found
1>D:\Development\lib\boost_1_47_0\boost/smart_ptr/detail/spinlock_w32.hpp(62): error C2440: 'initializing' : cannot convert from 'long (__stdcall *)(volatile long *,long)' to 'long'
1> There is no context in which this conversion is possible
1>D:\Development\lib\boost_1_47_0\boost/asio/detail/impl/signal_set_service.ipp(74): error C2664: 'signal' : cannot convert parameter 2 from 'void (__stdcall *)(int)' to 'void (__cdecl *)(int)'
1> None of the functions with this name in scope match the target type
1>D:\Development\lib\boost_1_47_0\boost/asio/detail/impl/signal_set_service.ipp(246): error C2664: 'signal' : cannot convert parameter 2 from 'void (__stdcall *)(int)' to 'void (__cdecl *)(int)'
1> None of the functions with this name in scope match the target type
1>main.cpp(20): warning C4007: 'main' : must be '__cdecl'

我该如何解决它们?有什么小想法或提示吗?

最佳答案

你还需要

  • #define BOOST_USE_WINDOWS_H
  • 可能还有/Gz (__stdcall)

关于c++ - 使用 __stdcall 和 Boost 1.47.0 编译错误 log4cxx,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7980396/

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