我最近下载了 Netbeans,但我无法让 C++ 组件正常工作,当我尝试编译示例程序时出现此错误:
"/c/Users/*/Documents/NetBeansProjects/Welcome_1/"C:/Program Files (x86)/MinGW/msys/1.0/bin/make.exe"" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
/bin/sh: -c: line 0: syntax error near unexpected token `('
/bin/sh: -c: line 0 `"/c/Users/*/Documents/NetBeansProjects/Welcome_1/"C:/Program Files (x86)/MinGW/msys/1.0/bin/make.exe"" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf'
make.exe": *** [.build-impl] Error 2
BUILD FAILED (exit value 2, total time: 3s)
我正在使用以下构建工具:
家族:MinGW
基本目录:C:\Program Files (x86)\MinGW\bin
C 编译器:C:\Program Files (x86)\MinGW\bin\gcc.exe
C++ 编译器:C:\Program Files (x86)\MinGW\bin\g++.exe
Fortran 编译器:C:\Program Files (x86)\MinGW\bin\gfortran.exe
汇编程序:C:\Program Files (x86)\MinGW\bin\as.exe
制作命令:C:\Program Files (x86)\MinGW\bin\msys\1.0\bin\make.exe
或者,我使用了 C:\Program Files (x86)\Msys\1.0\bin\make.exe
调试器命令:C:\Program Files (x86)\MinGW\bin\gdb.exe
最佳答案
我在 Windows 8 上使用 Nuwen 的 MinGW“发行版”和 MSYS 全新安装 NetBeans 7.3 时遇到了完全相同的问题。我使用了 MSYS make,顺便说一句,它没有被自动检测到。
奇怪的是:
"/c/Users/*/Documents/NetBeansProjects/Welcome_1/"C:/Program Files (x86)/MinGW/msys/1.0/bin/make.exe"" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
正如我们所见,当前项目的路径和生成可执行文件的路径粘合在一起,因此我们显然会出错。
我首先做的是比较我的 make 可执行文件的版本。我有两个 make 可执行文件:
c:\MSYS\bin\make.exe
- 3.81GNU Make 3.81 Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
This program built for i686-pc-msys
c:\MinGW\bin\make.exe
- 3.82GNU Make 3.82 Built for i686-pc-mingw32 Copyright (C) 2010 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
我将 NB 指向 MSYS,但当我将其更改为 MinGW 时 - 它神奇地开始正常工作。
关于c++ - 我无法让 Netbeans C++ 工作,我做错了什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9959679/