默认创建main.cpp.it成功编译。但是当我添加另一个c ++源文件时,构建失败。这意味着如果添加了多个文件,则构建失败。这是错误
"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf make[1]: Entering directory '/cygdrive/c/Users/Shantanu/Documents/NetBeansProjects/CppApplication_2' "/usr/bin/make" -f nbproject/Makefile-Debug.mk dist/Debug/Cygwin_4.x-Windows/cppapplication_2.exe make[2]: Entering directory '/cygdrive/c/Users/Shantanu/Documents/NetBeansProjects/CppApplication_2' mkdir -p build/Debug/Cygwin_4.x-Windows rm -f "build/Debug/Cygwin_4.x-Windows/newfile.o.d" g++ -c -g -MMD -MP -MF "build/Debug/Cygwin_4.x-Windows/newfile.o.d" -o build/Debug/Cygwin_4.x-Windows/newfile.o newfile.cpp mkdir -p build/Debug/Cygwin_4.x-Windows rm -f "build/Debug/Cygwin_4.x-Windows/newfile1.o.d" g++ -c -g -MMD -MP -MF "build/Debug/Cygwin_4.x-Windows/newfile1.o.d" -o build/Debug/Cygwin_4.x-Windows/newfile1.o newfile1.cpp mkdir -p dist/Debug/Cygwin_4.x-Windows g++ -o dist/Debug/Cygwin_4.x-Windows/cppapplication_2 build/Debug/Cygwin_4.x-Windows/newfile.o build/Debug/Cygwin_4.x-Windows/newfile1.o build/Debug/Cygwin_4.x-Windows/newfile1.o: In function `main': /cygdrive/c/Users/Shantanu/Documents/NetBeansProjects/CppApplication_2/newfile1.cpp:3: multiple definition of `main' build/Debug/Cygwin_4.x-Windows/newfile.o:/cygdrive/c/Users/Shantanu/Documents/NetBeansProjects/CppApplication_2/newfile.cpp:3: first defined here collect2: error: ld returned 1 exit status nbproject/Makefile-Debug.mk:63: recipe for target 'dist/Debug/Cygwin_4.x-Windows/cppapplication_2.exe' failed make[2]: *** [dist/Debug/Cygwin_4.x-Windows/cppapplication_2.exe] Error 1 make[2]: Leaving directory '/cygdrive/c/Users/Shantanu/Documents/NetBeansProjects/CppApplication_2' nbproject/Makefile-Debug.mk:60: recipe for target '.build-conf' failed make[1]: *** [.build-conf] Error 2 make[1]: Leaving directory '/cygdrive/c/Users/Shantanu/Documents/NetBeansProjects/CppApplication_2' nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed make: *** [.build-impl] Error 2 BUILD FAILED (exit value 2, total time: 955ms)