[英]std::cout inside main() not printing anything in debug console during debugging
[英]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.