2012-01-14 86 views
0

我想用C++學習YAML,我使用CMake將給定的yaml-cpp文件與VC++ Express 2010做成.dll和.lib文件。我已經建立了我的項目,就像我設置其他類似SFML的庫一樣。YAML與VC++ 2010將編譯爲發佈,但不是調試

我的問題是,當我嘗試建立對YAML-CPP網站給出的示例代碼的發佈版本,我得到:

Ogre 
Dragon 
Wizzard 

但是,當我嘗試建立一個調試版本,我得到:

Assertion failed: false, file d:\microsoft visual studio 10.0\vc\include\yaml-cp 
p\nodeimpl.h, line 39 

我不知道該如何處理。我是否需要構建庫的調試版本?如果是,如何?我不知道哪些項目選項可能會影響這個,如果我設法改變一些東西。

當我編譯,我得到一個警告:

d:\microsoft visual studio 10.0\vc\include\yaml-cpp\conversion.h(51): warning C4146: unary minus operator applied to unsigned type, result still unsigned 

有了很多的模板打印輸出,F.E. :

1>   d:\microsoft visual studio 10.0\vc\include\yaml-cpp\nodereadimpl.h(35) : see reference to function template instantiation 'bool YAML::ConvertScalar<T>(const YAML::Node &,T &)' being compiled 
1>   with 
1>   [ 
1>    T=unsigned int 
1>   ] 

這是我的問題嗎?壞的CMake文件和編譯?

+0

你可以發佈斷言發生的調用堆棧嗎? – 2012-01-17 01:53:30

回答

0
> yaml_test.exe!main() Line 108 C++ 
    yaml_test.exe!__tmainCRTStartup() Line 555 + 0x19 bytes C 
    yaml_test.exe!mainCRTStartup() Line 371 C 
    kernel32.dll!7c817077()  
    [Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll] 

中止於:

DOC [I] >>怪物;

該程序不會嘗試輸入重載函數。

在我自己的代碼中,當我嘗試使用我的第一個>>運算符時,這是在int中構建的。

我使用http://pastebin.com/PdKWDgQa的代碼,但對於原始的yaml-cpp示例代碼,它的功能相同。 Release模式下的輸出是正確的,Debug停止並返回相同的斷言代碼。

作爲參考,在>>功能怪物{托架在推出模式堆棧呼叫看起來像這樣:

> yaml_test.exe!operator>>(const YAML::Node & node={...}, Monster & monster={...}) Line 36 C++ 
    yaml_test.exe!main() Line 109 C++ 
    msvcr100.dll!_initterm(void (void)* * pfbegin=0x00000001, void (void)* * pfend=0x003a5050) Line 873 C 
    yaml_test.exe!__tmainCRTStartup() Line 555 + 0x17 bytes C 
    kernel32.dll!7c817077()  
    [Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll] 

編輯:

事實上,我已經重建了YAML-CPP我用CMake製作的項目作爲調試,當我現在使用它時,一切運行良好。我很抱歉,如果這是顯而易見的,我是新來的這類問題。

相關問題