gpt4 book ai didi

c++ - 在 Release模式下编译错误但在 Debug模式下不编译

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

当我在 Debug模式下在 VS 2008 上编译时,一切正常。当我在 Release模式下编译同样的东西时,并非一切正常。据我所知,包含目录是相同的,并且没有额外的预处理器符号。

有什么帮助吗?

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

它最终指向的代码行是:

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

编辑:更多信息:

当我的预处理器包含 NDEBUG 而不是 _DEBUG 时,我就得到了这个错误。如果我将我的发布配置更改为具有 _DEBUG isstead,它会编译。为什么?

最佳答案

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

您可以通过禁用 checked iterators 来解决它:

#define _SECURE_SCL 0

但请注意:如果您链接到启用了 _SECURE_SCL 的第三方库,例如boost ,内存损坏可能(并且将会)发生。

关于c++ - 在 Release模式下编译错误但在 Debug模式下不编译,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3884823/

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