c ++ hello world抛出分段错误 - MinGW,Netbeans

时间:2015-11-27 15:23:43

标签: c++ netbeans segmentation-fault mingw

设置MinGW和Netbeans。以前只与IDE和编译器一起工作。我的机器是x64 win7x64。如果我只安装了32位版本的MinGW,我不会感到害羞。

用x64编译一个简单的Helle World利用:

g++ -m64   -c -g -MMD -MP -MF "build/Debug/MinGW-Windows/main.o.d" 
    -o build/Debug/MinGW-Windows/main.o main.cpp
//Message: sorry, unimplemented: 64-bit mode not compiled in

The win32 Version compiles fine.
// ---
g++ -m32   -c -g -MMD -MP -MF "build/Debug/MinGW-Windows/main.o.d"
    -o build/Debug/MinGW-Windows/main.o main.cpp
// Compiles without any error...

启动32版本时,它只打印一条消息,并在从第一个std:cout返回之前终止分段错误。使用ftream,使文件输出出现相同的错误。 netbeans“欢迎”的demo-Programm引发了同样的例外。

#include <cstdlib>
#include <iostream>   // EDIT! (worked at this post long time sry.)
using namespace std;

int main(int argc, char** argv) {

int i = 0; // for making shure, program is working before calling fs.open
std::cout << "hello world blubb" << endl;   // this one shows up its message at consol.
//programm aborded.
std::cout << "Now again" << endl;   // this on is never reached.
return 0;
}

Errormessages:

Signal received: SIGSEGV ( Segmentation fault )
For programm cppapplication_1 pid 7972

You may discard...

错误消息窗口:

cppapplication_1.exe does not work.

我可以在哪里开始搜索?编译器?一些dll? Dependency Walker?

任何评论的Thx =)。 Cutton

0 个答案:

没有答案