我有 3 台计算机,其中两台使用 Windows 8。使用最新版本的 MinGW 的 g++ (4.8.1-4),每当我在 Windows 8 计算机上而不是在 Windows 7 上编译和运行时,我的 hello world 程序都会冻结。
#include <iostream>
int main()
{
std::cout << "Hello, World!" <<std::endl;
return 0;
}
这在 g++ 中编译得很好,但运行 a.exe 将显示“Hello, World!” 然后会弹出一个窗口并说“a.exe已停止工作,Windows可以在线检查程序的解决方案......”等。
有没有人看到这个问题。
另外,我尝试了 "std::cout << "Hello, World!\n" << std::flush;" 这也有同样的问题。似乎每个刷新缓冲区的函数都会导致崩溃。
按照 Eric 的建议,我重新编译了程序并在 gdb 中运行它并得到以下输出:
Program received signal SIGILL, Illegal instruction.
0x00405065 in _Jv_RegisterClasses ()