【发布时间】:2010-10-07 18:48:29
【问题描述】:
当我在调试模式下在 VS 2008 上编译时,一切正常。 当我在发布模式下编译相同的东西时,并非一切正常。据我所知,包含目录是相同的,并且没有额外的预处理器符号。
有什么帮助吗?
1>zlib.cpp 1>C:\Program 文件 (x86)\Microsoft Visual Studio 9.0\VC\include\xutility(419):错误 C2664: 'CryptoPP::AllocatorWithCleanup::AllocatorWithCleanup(const CryptoPP::AllocatorWithCleanup &)' : 无法将参数 1 从 'CryptoPP::AllocatorWithCleanup' 到 '常量 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' 到 '常量 CryptoPP::AllocatorWithCleanup' 1> 与 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) : 编译类模板成员时 功能 'std::_Container_base_aux_alloc_real<_alloc>::_Container_base_aux_alloc_real(_Alloc)' 1> 与 1> [ 1>
_Alloc=CryptoPP::AllocatorWithCleanup 1> ] 1> C:\程序文件 (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:\程序文件 (x86)\Microsoft Visual Studio 9.0\VC\include\vector(439) : 参见类模板参考 实例化 'std::_Vector_val<_ty>' 是 编译 1> 与 1> [ 1> _Ty=CryptoPP::HuffmanDecoder::CodeInfo, 1>
_Alloc=CryptoPP::AllocatorWithCleanup 1> ] 1>
C:\myproject\sshlib\zinflate.h(79) : 请参阅对类模板的引用 实例化 'std::vector<_ty>' 正在编译 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 而不是它可以编译。为什么?
【问题讨论】:
-
向量上的分配器参数看起来像一个常量问题。你有更多代码吗?
-
#defining
_DEBUG基本上将构建切换到调试模式。 Microsoft STL 的自定义分配器策略在调试模式下有所不同,不受该 bug 的影响。请参阅下面我的答案中的 Nabble 链接。
标签: c++ compiler-errors crypto++