2015-08-28 29 views
0

錯誤運行簡單的C++程序:誤差在建築和在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)

+0

謝謝@willShackleford –

回答

0

兩個C++源文件有一個主要方法:main.cpp中和newfile.cpp

刪除項目中的一個文件或重命名其中的主要方法。