ubuntu下使用Netbeans7.2无法编译C++
发表于 : 2012-11-21 20:52
我机器下载了g++,在命令行中,可以编译c++程序。但使用Netbeans7.2之后,不知道如何配置c++编译环境。我在【tool】-> 【options】->【c++ compiler】里配置的g++路径是【/usr/bin/g++】,结果出现下面的错误,请高手们指点一下……
"/usr/bin/make" -f nbproject/Makefile-Release.mk QMAKE= SUBPROJECTS= .clean-conf
make[1]: Entering directory `/opt/NetbeanWorkspace/CppApplication_1'
rm -f -r build/Release
rm -f dist/Release/GNU-Linux-x86/cppapplication_1
make[1]: Leaving directory `/opt/NetbeanWorkspace/CppApplication_1'
CLEAN SUCCESSFUL (total time: 114ms)
"/usr/bin/make" -f nbproject/Makefile-Release.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory `/opt/NetbeanWorkspace/CppApplication_1'
"/usr/bin/make" -f nbproject/Makefile-Release.mk dist/Release/GNU-Linux-x86/cppapplication_1
make[2]: Entering directory `/opt/NetbeanWorkspace/CppApplication_1'
mkdir -p build/Release/GNU-Linux-x86
rm -f build/Release/GNU-Linux-x86/Demo1.o.d
g++ -c -O2 -I/usr/include/c++/4.6.3 -MMD -MP -MF build/Release/GNU-Linux-x86/Demo1.o.d -o build/Release/GNU-Linux-x86/Demo1.o Demo1.cpp
mkdir -p build/Release/GNU-Linux-x86
rm -f build/Release/GNU-Linux-x86/main.o.d
g++ -c -O2 -I/usr/include/c++/4.6.3 -MMD -MP -MF build/Release/GNU-Linux-x86/main.o.d -o build/Release/GNU-Linux-x86/main.o main.cpp
mkdir -p dist/Release/GNU-Linux-x86
g++ -o dist/Release/GNU-Linux-x86/cppapplication_1 build/Release/GNU-Linux-x86/Demo1.o build/Release/GNU-Linux-x86/main.o
build/Release/GNU-Linux-x86/main.o: In function `main':
main.cpp:(.text.startup+0x0): multiple definition of `main'
build/Release/GNU-Linux-x86/Demo1.o:Demo1.cpp:(.text.startup+0x0): first defined here
collect2: ld returned 1 exit status
make[2]: *** [dist/Release/GNU-Linux-x86/cppapplication_1] Error 1
make[2]: Leaving directory `/opt/NetbeanWorkspace/CppApplication_1'
make[1]: *** [.build-conf] Error 2
make[1]: Leaving directory `/opt/NetbeanWorkspace/CppApplication_1'
make: *** [.build-impl] Error 2
BUILD FAILED (exit value 2, total time: 798ms)
"/usr/bin/make" -f nbproject/Makefile-Release.mk QMAKE= SUBPROJECTS= .clean-conf
make[1]: Entering directory `/opt/NetbeanWorkspace/CppApplication_1'
rm -f -r build/Release
rm -f dist/Release/GNU-Linux-x86/cppapplication_1
make[1]: Leaving directory `/opt/NetbeanWorkspace/CppApplication_1'
CLEAN SUCCESSFUL (total time: 114ms)
"/usr/bin/make" -f nbproject/Makefile-Release.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory `/opt/NetbeanWorkspace/CppApplication_1'
"/usr/bin/make" -f nbproject/Makefile-Release.mk dist/Release/GNU-Linux-x86/cppapplication_1
make[2]: Entering directory `/opt/NetbeanWorkspace/CppApplication_1'
mkdir -p build/Release/GNU-Linux-x86
rm -f build/Release/GNU-Linux-x86/Demo1.o.d
g++ -c -O2 -I/usr/include/c++/4.6.3 -MMD -MP -MF build/Release/GNU-Linux-x86/Demo1.o.d -o build/Release/GNU-Linux-x86/Demo1.o Demo1.cpp
mkdir -p build/Release/GNU-Linux-x86
rm -f build/Release/GNU-Linux-x86/main.o.d
g++ -c -O2 -I/usr/include/c++/4.6.3 -MMD -MP -MF build/Release/GNU-Linux-x86/main.o.d -o build/Release/GNU-Linux-x86/main.o main.cpp
mkdir -p dist/Release/GNU-Linux-x86
g++ -o dist/Release/GNU-Linux-x86/cppapplication_1 build/Release/GNU-Linux-x86/Demo1.o build/Release/GNU-Linux-x86/main.o
build/Release/GNU-Linux-x86/main.o: In function `main':
main.cpp:(.text.startup+0x0): multiple definition of `main'
build/Release/GNU-Linux-x86/Demo1.o:Demo1.cpp:(.text.startup+0x0): first defined here
collect2: ld returned 1 exit status
make[2]: *** [dist/Release/GNU-Linux-x86/cppapplication_1] Error 1
make[2]: Leaving directory `/opt/NetbeanWorkspace/CppApplication_1'
make[1]: *** [.build-conf] Error 2
make[1]: Leaving directory `/opt/NetbeanWorkspace/CppApplication_1'
make: *** [.build-impl] Error 2
BUILD FAILED (exit value 2, total time: 798ms)