我刚刚安装了带有 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/