YAML 与 VC++ 2010将编译为Release,但不会编译为Debug

发布于 2024-12-26 14:57:17 字数 1086 浏览 1 评论 0原文

我正在尝试使用 C++ 学习 YAML,我使用 CMake 使用 VC++ Express 2010 将给定的 yaml-cpp 文件转换为 .dll 和 .lib 文件。我设置我的项目的方式与设置其他库(如 SFML)相同。

我的问题是,当我尝试构建 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

With alot of template printouts, fe :

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>          ]

Is this a Problem on my side? CMake 文件和编译错误?

I'm trying to learn YAML with C++, i made the given yaml-cpp files into a .dll and .lib file with VC++ Express 2010 by using CMake. I have set up my project the same way i set up other libraries like SFML.

My issue is, when i try to build a Release version of the example code given on the yaml-cpp site i get:

Ogre
Dragon
Wizzard

However, when i try to build a Debug version, i get:

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

I don't know how to handle this. Do i need to build a debug version of the library? If yes, how? I don't know which project options could affect this if i managed to change something.

When i'm compiling, i get a warning:

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

With alot of template printouts, 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>          ]

Is this a problem on my side? Bad CMake file and compilation?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

孤千羽 2025-01-02 14:57:17
>   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停止并返回相同的断言代码。

作为参考,Release 模式下的堆栈调用位于 >> 中的 { 括号处。 Monster 的函数看起来像这样:

>   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]

编辑:

实际上,我已经重建了我用 CMake 制作的 yaml-cpp 项目作为调试,当我现在使用它时,一切都运行良好。如果这是显而易见的,我很抱歉,我对此类问题很陌生。

>   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]

Aborts at:

doc[i] >> monster;

The program doesn't try to enter the overloaded function.

In my own code it breaks when i try to use my first >> operator, which is the build in one for int.

I'm using the code from http://pastebin.com/PdKWDgQa, though for the original yaml-cpp example code it does the same. The output in Release mode is right, Debug stops and returns the same assert code.

For reference, the stack call in Release mode at the { bracket in the >> function for monster looks like this:

>   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]

EDIT:

Actually, i have rebuilt the yaml-cpp project i made with CMake as Debug, everything runs fine when i use it now. I'm sorry if this is obvious, i'm new to these kind of issues.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文