繁体   English   中英

调试过程中双重提示失败

[英]Double cout failure during debug

当我尝试调试此代码段时,我得到了这个奇怪的...奇怪。

#include <iostream>
#include <conio.h>
#include "windows.h"
#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>

double frameCount;

int main()    
{
    frameCount = 18;
    std::cout << frameCount << std::endl;
    return 0;
}

它可以毫无问题地进行编译。 它甚至可以正常运行,但是如果我逐行调试它,则当我尝试将“ frameCount”输出到控制台时,该程序将被占用;

    std::cout << frameCount << std::endl;

通过将“ frameCount”更改为int可以解决此问题。 这是该行的调试器结果。

[debug]> next
[debug]0x004496f4 in std::ostream::operator<<(double) ()
[debug]>>>>>>cb_gdb:

In std::ostream::operator<<(double) () ()

[debug]> info locals
[debug]No symbol table info available.
[debug]>>>>>>cb_gdb:
[debug]> info args
[debug]No symbol table info available.
[debug]>>>>>>cb_gdb:
[debug]> whatis frameCount
[debug]type = double
[debug]>>>>>>cb_gdb:
[debug]> output frameCount
[debug]1.8>>>>>>cb_gdb:
[debug]> bt 30
[debug]#0  0x004496f4 in std::ostream::operator<<(double) ()
[debug]#1  0x004165ae in __do_global_ctors ()
[debug]#2  0x004010fd in __mingw_CRTStartup ()
[debug]#3  0x00000001 in ?? ()
[debug]#4  0x7ffde000 in ?? ()
[debug]#5  0x7757ad1f in ?? ()
[debug]#6  0x7757acea in ?? ()
[debug]#7  0x00000000 in ?? ()
[debug]>>>>>>cb_gdb:

出于您的目的,您不需要

#include <conio.h>
#include "windows.h"
#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>

在标题上方。 没有这些标题。 好像还好

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM