在 netbeans 中构建和 运行 简单的 C++ 程序时出错

error in building and running simple c++ program in netbeans

错误:

"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory `/home/mohammad/NetBeansProjects/CppApplication_1'
"/usr/bin/make"  -f nbproject/Makefile-Debug.mk dist/Debug/GNU-Linux-x86/cppapplication_1
make[2]: Entering directory `/home/mohammad/NetBeansProjects/CppApplication_1'
mkdir -p dist/Debug/GNU-Linux-x86
g++     -o dist/Debug/GNU-Linux-x86/cppapplication_1 build/Debug/GNU-Linux-x86/main.o build/Debug/GNU-Linux-x86/newfile.o build/Debug/GNU-Linux-x86/newmain.o 
build/Debug/GNU-Linux-x86/newfile.o: In function `main':
/home/mohammad/NetBeansProjects/CppApplication_1/newfile.cpp:5: multiple definition of `main'
build/Debug/GNU-Linux-x86/main.o:/home/mohammad/NetBeansProjects/CppApplication_1/main.cpp:15: first defined here
build/Debug/GNU-Linux-x86/newmain.o: In function `main':
/home/mohammad/NetBeansProjects/CppApplication_1/newmain.c:14: multiple definition of `main'
build/Debug/GNU-Linux-x86/main.o:/home/mohammad/NetBeansProjects/CppApplication_1/main.cpp:15: first defined here
collect2: error: ld returned 1 exit status
make[2]: *** [dist/Debug/GNU-Linux-x86/cppapplication_1] Error 1
make[2]: Leaving directory `/home/mohammad/NetBeansProjects/CppApplication_1'
make[1]: *** [.build-conf] Error 2
make[1]: Leaving directory `/home/mohammad/NetBeansProjects/CppApplication_1'
make: *** [.build-impl] Error 2

BUILD FAILED(退出值2,总时间:168ms)

两个 C++ 源文件有一个 main 方法:main.cpp 和 newfile.cpp

从项目中删除其中一个文件或重命名其中的主要方法。