我已经在我的Windows 8机器和Ubuntu VM上安装了Netbeans,以查看错误是否一致并且它们是否一致。安装Netbeans后,我可以运行一个简短的脚本,一切都很好。如果我向程序添加一个文件,Netbeans会破坏并变得无法使用。我的Cygwin已正确设置所有适当的插件(据我所知)。此外,我的库未正确加载。 "找不到包含文件"或任何其他人。
"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory '/cygdrive/c/Users/Sean/Documents/NetBeansProjects/C++'
"/usr/bin/make" -f nbproject/Makefile-Debug.mk dist/Debug/Cygwin_4.x-Windows/c__.exe
make[2]: Entering directory '/cygdrive/c/Users/Sean/Documents/NetBeansProjects/C++'
mkdir -p dist/Debug/Cygwin_4.x-Windows
g++ -o dist/Debug/Cygwin_4.x-Windows/c__ build/Debug/Cygwin_4.x-Windows/main.o build/Debug/Cygwin_4.x-Windows/test.o
build/Debug/Cygwin_4.x-Windows/test.o: In function `main':
/cygdrive/c/Users/Sean/Documents/NetBeansProjects/C++/test.cpp:9: multiple definition of `main'
build/Debug/Cygwin_4.x-Windows/main.o:/cygdrive/c/Users/Sean/Documents/NetBeansProjects/C++/main.cpp:15: first defined here
collect2: error: ld returned 1 exit status
nbproject/Makefile-Debug.mk:63: recipe for target 'dist/Debug/Cygwin_4.x-Windows/c__.exe' failed
make[2]: *** [dist/Debug/Cygwin_4.x-Windows/c__.exe] Error 1
make[2]: Leaving directory '/cygdrive/c/Users/Sean/Documents/NetBeansProjects/C++'
nbproject/Makefile-Debug.mk:60: recipe for target '.build-conf' failed
make[1]: *** [.build-conf] Error 2
make[1]: Leaving directory '/cygdrive/c/Users/Sean/Documents/NetBeansProjects/C++'
nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed
make: *** [.build-impl] Error 2
BUILD FAILED (exit value 2, total time: 479ms)
答案 0 :(得分:0)
您收到的错误是您已定义main
(您的计划的入口点)两次:
build / Debug / Cygwin_4.x-Windows / test.o:在函数
main': /cygdrive/c/Users/Sean/Documents/NetBeansProjects/C++/test.cpp:9: multiple definition of
main' build / Debug / Cygwin_4.x-Windows / main.o:/ cygdrive / c / Users / Sean / Documents / NetBeansProjects / C ++ / main.cpp:15:首先在这里定义
此处它告诉您,您已定义main
两次:第9行test.cpp
一次,第15行main.cpp
一次。