示例代码
#include <cstdlib>
#include <iostream>
using namespace std;
/*
*
*/
int main() {
cout<<"hello";
return 0;
}
netbeans ide中产生的错误
"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory '/cygdrive/c/Users/dell/Desktop/coding/CppApplication_1'
"/usr/bin/make" -f nbproject/Makefile-Debug.mk dist/Debug/Cygwin-Windows/cppapplication_1.exe
make[2]: Entering directory '/cygdrive/c/Users/dell/Desktop/coding/CppApplication_1'
mkdir -p dist/Debug/Cygwin-Windows
g++ -o dist/Debug/Cygwin-Windows/cppapplication_1 build/Debug/Cygwin-Windows/main.o build/Debug/Cygwin-Windows/newfile.o
build/Debug/Cygwin-Windows/newfile.o: In function `main':
/cygdrive/c/Users/dell/Desktop/coding/CppApplication_1/newfile.cpp:4: multiple definition of `main'
build/Debug/Cygwin-Windows/main.o:/cygdrive/c/Users/dell/Desktop/coding/CppApplication_1/main.cpp:16: first defined here
collect2: error: ld returned 1 exit status
make[2]: *** [nbproject/Makefile-Debug.mk:64: dist/Debug/Cygwin-Windows/cppapplication_1.exe] Error 1
make[2]: Leaving directory '/cygdrive/c/Users/dell/Desktop/coding/CppApplication_1'
make[1]: *** [nbproject/Makefile-Debug.mk:60: .build-conf] Error 2
make[1]: Leaving directory '/cygdrive/c/Users/dell/Desktop/coding/CppApplication_1'
make: *** [nbproject/Makefile-impl.mk:40: .build-impl] Error 2
BUILD FAILED (exit value 2, total time: 802ms)
我不确定出了什么问题,但无法解决此问题并检查了所有可用的解决方案,但它仍然存在。