gpt4 book ai didi

c++ - 无法在 Netbeans 中编译单个 C++ 文件,但能够构建完整的项目

转载 作者:行者123 更新时间:2023-11-28 04:49:59 31 4
gpt4 key购买 nike

当我右键单击并尝试编译文件时,我在 Netbeans 中遇到了单文件编译问题。我遇到了“ Netbeans: cannot find include file <iostream>, also, unable to resolve identifier std, cout ”中给出的其他问题并解决了所有其他问题。构建工作正常,但只是编译问题。

编译错误:

cd 'C:\Study Materials\C++\CPP Programs MP Compiled\Projects\collegeProject\collegeProject'
C:\MinGW\MSYS 1.0\bin\make.exe -f nbproject/Makefile-Debug.mk build/Debug/MinGW-Windows/FileHandling.o
Cannot run program "C:\MinGW\MSYS" (in directory "C:\Study Materials\C++\CPP Programs MP Compiled\Projects\collegeProject\collegeProject"): CreateProcess error=2, The system cannot find the file specified

构建日志(仅部分):

cd 'C:\Study Materials\C++\CPP Programs MP Compiled\Projects\collegeProject\collegeProject'
C:\MinGW\MSYS 1.0\bin\make.exe -f Makefile CONF=Debug
"/C/MinGW/MSYS 1.0/bin/make.exe" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make.exe[1]: Entering directory `/c/Study Materials/C++/CPP Programs MP Compiled/Projects/collegeProject/collegeProject'
"/C/MinGW/MSYS 1.0/bin/make.exe" -f nbproject/Makefile-Debug.mk dist/Debug/MinGW-Windows/collegeproject.exe
make.exe[2]: Entering directory `/c/Study Materials/C++/CPP Programs MP Compiled/Projects/collegeProject/collegeProject'
mkdir -p build/Debug/MinGW-Windows
rm -f "build/Debug/MinGW-Windows/FileHandling.o.d"
g++ -c -g -std=c++11 -MMD -MP -MF "build/Debug/MinGW-Windows/FileHandling.o.d" -o build/Debug/MinGW-Windows/FileHandling.o FileHandling.cpp
mkdir -p build/Debug/MinGW-Windows
rm -f "build/Debug/MinGW-Windows/admin.o.d"
.
.
.

mkdir -p dist/Debug/MinGW-Windows
g++ -o dist/Debug/MinGW-Windows/collegeproject build/Debug/MinGW-Windows/FileHandling.o build/Debug/MinGW-Windows/admin.o build/Debug/MinGW-Windows/login.o build/Debug/MinGW-Windows/main.o build/Debug/MinGW-Windows/person.o build/Debug/MinGW-Windows/staff.o build/Debug/MinGW-Windows/student.o build/Debug/MinGW-Windows/subjects.o build/Debug/MinGW-Windows/utilities.o
make.exe[2]: Leaving directory `/c/Study Materials/C++/CPP Programs MP Compiled/Projects/collegeProject/collegeProject'
make.exe[1]: Leaving directory `/c/Study Materials/C++/CPP Programs MP Compiled/Projects/collegeProject/collegeProject'

BUILD SUCCESSFUL (total time: 8s)

最佳答案

问题是 MinGW 路径“C:\MinGW\MSYS”中的空格只是路径“C:\MinGW\MSYS 1.0”的一部分。确保路径中没有空格 安装 MinGW 和 MSYS 的位置。

mingw.org/wiki/Getting_Started

MinGW Installation Notes

MinGW may have problems with paths containing spaces, and if not,usually other programs used with MinGW will experience problems withsuch paths. Thus, we strongly recommend that you do not install MinGWin any location with spaces in the path name reference. You shouldavoid installing into any directory or subdirectory having names like"Program Files" or "My Documents", etc.

另见 Netbeans and MinGW-w64 .

关于c++ - 无法在 Netbeans 中编译单个 C++ 文件,但能够构建完整的项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48413589/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com