无法编译“Hello World”在NetBeans IDE 7.3中使用MinGW C ++ [英] Cannot Compile "Hello World" in NetBeans IDE 7.3 with MinGW C++

查看:937
本文介绍了无法编译“Hello World”在NetBeans IDE 7.3中使用MinGW C ++的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个简单的Hello World!程序在NetBeans IDE 7.3与MinGW作为我的C ++编译器。

I'm trying to make a simple "Hello World!" program in NetBeans IDE 7.3 with MinGW as my C++ compiler.

我遇到构建失败,我很失去了解为什么。

I'm getting build failures and I'm at a loss as to understanding why.

这是我的编译器设置:


  • 系列: MinGW
  • 基本目录: C:\MinGW

  • C编译器: C:\ MinGW \bin\gcc.exe

  • C ++编译器: C:\MinGW\bin\g ++。exe

  • 汇编器: C:\MinGW\bin\as.exe

  • 输入命令: C: \\ MinGW \msys\1.0\bin\make.exe

  • 调试器命令: C:\MinGW\bin\gdb.exe

  • Family: MinGW
  • Base Directory: C:\MinGW
  • C Compiler: C:\MinGW\bin\gcc.exe
  • C++ Compiler: C:\MinGW\bin\g++.exe
  • Assembler: C:\MinGW\bin\as.exe
  • Make Command: C:\MinGW\msys\1.0\bin\make.exe
  • Debugger Command: C:\MinGW\bin\gdb.exe

我确定我的环境PATH指向 C:\MinGW\bin C:\MinGW\msys\1.0\bin

I've made sure to that my environment PATH directs to C:\MinGW\bin and C:\MinGW\msys\1.0\bin.

我的代码是:

#include <iostream>
using namespace std;
int main()
{
    cout << "Hello World!" << endl;
    return 0;
}

尝试构建项目后,我从NetBeans调试输出接收到此消息:

After trying to build the project, I recieve this message from the NetBeans debug output:

"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory `/c/NetBeansProjects/HelloWorld'
"/usr/bin/make"  -f nbproject/Makefile-Debug.mk dist/Debug/MinGW-Windows/helloworld.exe
make[2]: Entering directory `/c/NetBeansProjects/HelloWorld'
mkdir -p build/Debug/MinGW-Windows
rm -f build/Debug/MinGW-Windows/main.o.d
g++    -c -g -MMD -MP -MF build/Debug/MinGW-Windows/main.o.d -o build/Debug/MinGW-Windows/main.o main.cpp
make[2]: g++: Command not found
make[2]: *** [build/Debug/MinGW-Windows/main.o] Error 127
make[2]: Leaving directory `/c/NetBeansProjects/HelloWorld'
make[1]: *** [.build-conf] Error 2
make[1]: Leaving directory `/c/NetBeansProjects/HelloWorld'
make: *** [.build-impl] Error 2


BUILD FAILED (exit value 2, total time: 1s)

我搜索了各种Q& A,但我似乎做的一切正确。

I've search various Q&A, but I seem to be doing everything correctly.

推荐答案

右键单击我的电脑并选择属性。单击高级系统设置。系统属性对话框将打开。单击环境变量。编辑PATH变量并添加C:\MinGW\msys\1.0\bin

Right click on My Computer and select properties. Click Advanced System Settings.System Properties dialog box will open. click Environmental Variables. Edit PATH variable and add C:\MinGW\msys\1.0\bin

这篇关于无法编译“Hello World”在NetBeans IDE 7.3中使用MinGW C ++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆