簡體   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