繁体   English   中英

在发布模式下编译时出错,但在调试模式下编译时出错

[英]Error compiling in release mode but not in debug mode

当我以deubg模式在VS 2008上编译时,一切正常。 当我在发布模式下编译相同的东西时,并非一切正常。 据我所知,include目录是相同的,并且没有其他预处理器符号。

有帮助吗?

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 :: AllocatorWithCleanup'转换为'const CryptoPP :: AllocatorWithCleanup&'1>,其中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>并带有1> [1>
T = CryptoPP :: HuffmanDecoder :: CodeInfo 1>] 1>和1> [1> T = std :: _ Aux_cont 1>
] 1>没有可用的用户定义转换运算符可以执行此转换,否则无法调用该运算符1> C:\\ Program Files(x86)\\ Microsoft Visual Studio 9.0 \\ VC \\ include \\ xutility(417):编译时类模板成员函数'std :: _ Container_base_aux_alloc_real <_Alloc> :: _ Container_base_aux_alloc_real(_Alloc)'1>,其中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>编译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):请参见对类模板实例化'std :: vector <_Ty,_Ax>'的引用,正在使用1>和1>进行编译
[1>
_Ty = CryptoPP :: HuffmanDecoder :: CodeInfo,1>
_Ax = CryptoPP :: AllocatorWithCleanup 1>] 1> zinflate.cpp

它最终指向的代码行是:

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

编辑:更多信息:

当我的预处理器包含NDEBUG而不是_DEBUG时,我得到此错误。 如果我将发布配置更改为_DEBUG istead,则会进行编译。 为什么?

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

您可以通过禁用选中的迭代器来解决此问题:

#define _SECURE_SCL 0

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

多年后回到C ++,我遇到了类似的错误。 事实证明,它与该错误无关,并且与我没有将Release配置更新为与Debug配置中使用的相同设置有关! 因此,对于那里的其他菜鸟,请记住在所有配置中确保您具有相同的字符集,CLR支持,包含目录,其他依赖关系,等等。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM