2011-11-02 205 views
0

我会,如果你帮助非常高兴。编译错误与__stdcall log4cxx和Boost 1.47.0

我的IDE是VS2010。

我使用升压1.47.0,特别是提高:: ASIO。

发展之后的一些日子里,我决定增加log4cxx。

log4cxx需要调用约定更改为__stdcall

,我意外的得到了很多编译错误。他们~70错误。

我GOOGLE了一下,发现这些:

#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' 

我该如何解决它们? 任何小想法或提示?

+0

请发表你的代码试图编译 –

+0

@SamMiller我有太多的代码发布它。而且,正如您所看到的,我无法知道我的代码中哪些错误是。 – nix

+0

欢迎来到调试!如果你能把问题归结为一个[简短的,自包含的,正确的](http://sscce.org/)的例子,它将帮助我们帮助你。 –

回答

0

如果你的代码看起来是这样的:

#include "log4cxx/logger.h" 
#include "log4cxx/basicconfigurator.h" 
#include "log4cxx/helpers/exception.h" 

using namespace log4cxx; 
using namespace log4cxx::helpers; 

int main() 
{ 
//stuff 
} 

和你-llog4cxx编译,那么你应该罚款。

1

您还需要

  • 的#define BOOST_USE_WINDOWS_H
  • 和可能/ GZ(__stdcall)
+0

好找,对我来说它是连接,因为我把'/ Gz'从你的建议,这表明不兼容的'/ CLR:pure',我这才意识到我改成'/ clr'在我的'Release'配置,但没有对我的'Debug'版本做同样的事情。 – jxramos