當我在VS 2008上以deubg模式編譯時,一切正常。 當我在發佈模式下編譯相同的東西時,並非一切正常。據我所知,包含目錄是相同的,沒有額外的預處理器符號。在發佈模式下編譯時出錯但在調試模式下不能編譯
任何幫助?
1> zlib.cpp 1> C:\ Program Files文件 (x86)的\微軟的Visual Studio 9.0 \ VC \ \包括xutility(419):錯誤C2664: 「CryptoPP :: AllocatorWithCleanup :: AllocatorWithCleanup (常量 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 =標準:: _ 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>沒有用戶定義的轉換 運算符可用,可以執行 這個轉換,或者o操作結束時切 不能稱之爲1> C:\ PROGRAM 文件(x86)\微軟的Visual Studio 9.0 \ VC \包括\ 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)的\微軟的Visual Studio 9.0 \ VC \包括\矢量( 421):請參閱參考類模板 實例化 'std :: _ Container_base_aux_alloc_real < _Alloc>' 正在編譯1> 1>
[1>
_Alloc = CryptoPP :: AllocatorWithCleanup 1> 1> C:\ Program Files文件 (x86)的\微軟的Visual Studio 9.0 \ VC \包括\矢量(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 ::矢量< _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處於非編譯狀態。爲什麼?
看起來像一個常量問題,在你的向量上有allocator參數。你有更多的代碼? – 2010-10-07 19:04:02
#defining'_DEBUG'基本上將構建切換到調試模式。 Microsoft STL的自定義分配器策略在調試模式下不同,並且不受該錯誤的影響。請參閱下面我的答案中的Nabble鏈接。 – 2010-10-07 19:21:29