我在我的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)
您收到的错误是您已经定义了两次main
(您的程序的入口点):
构建/调试/Cygwin_4.x-Windows/测试。0:在功能
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
:一次在test.cpp
在第9行,一次在main.cpp
在第15行。