c++ - 无法在 NetBeans 7.0 上编译 C++ 代码

标签 c++ netbeans configuration makefile mingw

我刚刚安装了带有 C++ 包的 NetBeans 7.0。它要求 C++ 编译器 - 我安装了 MinGW。我将它添加到 NetBeans(以便它识别它)。我觉得都是对的……

我在 main.cpp 中编写了非常简单的 C++ 应用程序并尝试编译它...

#include <cstdlib>
#include <iostream>


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

    std::cout << "Hello, world!";


    return 0;

}

它提示“制作命令”(在工具 -> 选项 -> C/C++ -> 构建工具下)。我尝试修复它并在其中键入 C:\MinGW\msys\1.0\bin\make.exe。我试图再次编译它!这是错误消息...

"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory `/c/Users/admin/Documents/C++/helloWorld'
"/usr/bin/make"  -f nbproject/Makefile-Debug.mk dist/Debug/MinGW-Windows/helloworld.exe
make[2]: Entering directory `/c/Users/admin/Documents/C++/helloWorld'
make[2]: mkdir: Command not found
mkdir -p build/Debug/MinGW-Windows
make[2]: *** [build/Debug/MinGW-Windows/main.o] Error 127
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
make[2]: Leaving directory `/c/Users/admin/Documents/C++/helloWorld'
make[1]: Leaving directory `/c/Users/admin/Documents/C++/helloWorld'

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

如何修复并正确配置 NetBeans(带有 C++ 包)?

最佳答案

我猜您没有将 msys 添加到您的 PATH 变量中。见 this entry in the Netbeans forum ,因为报告的错误与您在问题中粘贴的错误基本相同。所以,你收到的错误信息并没有提示 make,它提示它找不到 mkdir,它应该在你的 msys 目录中的一个目录中。将 C:\MinGW\msys\1.0\bin\ 添加到您的 windows PATH 变量可能足以解决此问题。

关于c++ - 无法在 NetBeans 7.0 上编译 C++ 代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5803126/

相关文章:

c++ - 简单的 cin cout 代码由 "build and run"运行,但在 bin/debug/x.exe 中不起作用

netbeans - Netbeans:如何在NullPointerException上中断?

java - 显示隐藏的 JFrame

java - Netbeans:为 JEditorPane 中的 Java 语法添加颜色

configuration - 如果您正在使用 Apache ZooKeeper,您将它用于什么?

elasticsearch - 如何将 tcp 重定向到 nginx 中 Elasticsearch 服务器的端口 9300?

database - 在 CodeIgniter 3 中即时更改数据库名称

c++ - 从包含子类指针的映射到包含父类(super class)指针的映射的转换

c++ - g++ 使用 "expected a type, got ' xyz' 拒绝我的简单仿函数”

c++ - 在C++中,不提供默认构造函数的类的实例是否可以单独声明和实例化(分两步)