在释放模式下编译但在调试模式下编译错误 [英] Error compiling in release mode but not in debug mode

查看:168
本文介绍了在释放模式下编译但在调试模式下编译错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在de 2008的VS 2008年编译一切正常。
当我在发布模式下编译同样的东西不是一切正常。就我可以告诉include目录是相同的,没有其他预处理符号。

When I compile on VS 2008 in deubg mode everything works fine. When I compile the same thing in release mode not everything works. As far as I can tell the include directories are the same and there are no additional preprocessor symbols.

任何帮助?


1> zlib.cpp 1> C:\Program Files
(x86)\ Microsoft Visual Studio
9.0 \VC\include\xutility 419):错误C2664:
'CryptoPP :: AllocatorWithCleanup :: AllocatorWithCleanup(const
CryptoPP :: AllocatorWithCleanup&)'
:不能从
转换参数1 CryptoPP :: AlchematorWithCleanup'to
'const
CryptoPP :: AllocatorWithCleanup&'
1> with 1> [1>

T = std :: _ Aux_cont 1>] 1>

和1> [1>

T = CryptoPP :: HuffmanDecoder :: CodeInfo
1>] 1>和1> [
1> T = std :: _ Aux_cont 1>

] 1>原因:无法将

'CryptoPP :: AllocatorWithCleanup'转换为
'const
CryptoPP :: AllocatorWithCleanup '1>
with 1> [1>

T = CryptoPP :: HuffmanDecoder :: CodeInfo
1>] 1>和1> [
1> T = std :: _ Aux_cont 1>

] 1>没有用户定义的转换
操作符可以执行
此转换,或者操作符
不能调用1> C:\Program
文件(x86)\Microsoft Visual Studio
9.0 \VC\include\xutility(417):编译类模板成员
function
'std :: _ Container_base_aux_alloc_real< _Alloc> :: _ Container_base_aux_alloc_real(_Alloc)'
1> with 1> [1>

_Alloc = CryptoPP :: AllocatorWithCleanup
1>] 1> C :\Program Files
(x86)\ Microsoft Visual Studio
9.0 \VC\include\vector(421):参见类模板
实例化
' std :: _ Container_base_aux_alloc_real< _Alloc>'
正在编译1> with 1>

[1>

_Alloc = CryptoPP :: AllocatorWithCleanup
1>] 1 > C:\Program Files
(x86)\ Microsoft Visual Studio
9.0 \VC\include\vector(439):参见类模板
实例化
'std :: _ Vector_val< _Ty,_Alloc>'是
编译的1>与1> [1>
_Ty = CryptoPP :: HuffmanDecoder :: CodeInfo,
1>

_Alloc = CryptoPP :: AllocatorWithCleanup
1>] 1>

C:\myproject\sshlib\zinflate.h(79):
参见类的引用template
instantiation'std :: vector< _Ty,_Ax>'
正在编译1> with 1>

[1>

_Ty = CryptoPP :: HuffmanDecoder :: CodeInfo,
1>

_Ax = CryptoPP :: AllocatorWithCleanup
1>] 1> zinflate.cpp

1>zlib.cpp 1>C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\xutility(419) : error C2664: 'CryptoPP::AllocatorWithCleanup::AllocatorWithCleanup(const CryptoPP::AllocatorWithCleanup &)' : cannot convert parameter 1 from 'CryptoPP::AllocatorWithCleanup' to 'const CryptoPP::AllocatorWithCleanup &' 1> with 1> [ 1>
T=std::_Aux_cont 1> ] 1>
and 1> [ 1>
T=CryptoPP::HuffmanDecoder::CodeInfo 1> ] 1> and 1> [ 1> T=std::_Aux_cont 1>
] 1> Reason: cannot convert from 'CryptoPP::AllocatorWithCleanup' to 'const CryptoPP::AllocatorWithCleanup' 1> with 1> [ 1>
T=CryptoPP::HuffmanDecoder::CodeInfo 1> ] 1> and 1> [ 1> T=std::_Aux_cont 1>
] 1> No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called 1> C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\xutility(417) : while compiling class template member function 'std::_Container_base_aux_alloc_real<_Alloc>::_Container_base_aux_alloc_real(_Alloc)' 1> with 1> [ 1>
_Alloc=CryptoPP::AllocatorWithCleanup 1> ] 1> C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\vector(421) : see reference to class template instantiation 'std::_Container_base_aux_alloc_real<_Alloc>' being compiled 1> with 1>
[ 1>
_Alloc=CryptoPP::AllocatorWithCleanup 1> ] 1> C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\vector(439) : see reference to class template instantiation 'std::_Vector_val<_Ty,_Alloc>' being compiled 1> with 1> [ 1> _Ty=CryptoPP::HuffmanDecoder::CodeInfo, 1>
_Alloc=CryptoPP::AllocatorWithCleanup 1> ] 1>
C:\myproject\sshlib\zinflate.h(79) : see reference to class template instantiation 'std::vector<_Ty,_Ax>' being compiled 1> with 1>
[ 1>
_Ty=CryptoPP::HuffmanDecoder::CodeInfo, 1>
_Ax=CryptoPP::AllocatorWithCleanup 1> ] 1>zinflate.cpp

它最终指向的代码行是:

The line of code it eventually points to is:

std::vector<CodeInfo, AllocatorWithCleanup<CodeInfo> > m_codeToValue;

编辑:更多信息

当我的预处理器包含NDEBUG而不是_DEBUG时,我得到这个错误。如果我改变我的版本配置为_DEBUG isntead它编译。为什么?

I get this error exactly when my preprocessor contains NDEBUG instead of _DEBUG. If I change my release config to have _DEBUG isntead it compiles. Why?

推荐答案

这是Visual C ++编译器中的一个错误。请参阅 http://old.nabble.com/-jira--Created:-%28QPID-1458%29-C%2B%2B-common-compile-error-in-VC9 -Release-mode-td20469700.html

It's a bug in the Visual C++ compiler. See http://old.nabble.com/-jira--Created:-%28QPID-1458%29-C%2B%2B-common-compile-error-in-VC9-Release-mode-td20469700.html.

您可以通过禁用检查迭代器

#define _SECURE_SCL 0

但请注意:如果您链接到第三方使用 _SECURE_SCL 编译的库,例如提升,内存损坏可能会(并且会发生)。

But be warned: if you link against a third-party library that was compiled with _SECURE_SCL enabled, like e.g. boost, memory corruption can (and will) occur.

这篇关于在释放模式下编译但在调试模式下编译错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆