1
我想在cygwin上編譯一個簡單的程序。我不知道爲什麼我的IDE(Netbeans)試圖使用'-c'標誌。在項目屬性 - > C++編譯器 - >其他選項我沒有'-c'標誌。如何解決這個問題?鏈接器輸入文件未使用,因爲鏈接沒有完成
"/usr/bin/make" -f nbproject/Makefile-Release.mk QMAKE= SUBPROJECTS= .clean-conf
make[1]: Entering directory '/cygdrive/c/Users/user/Documents/NetBeansProjects/CppApplication_3'
rm -f -r build/Release
rm -f dist/Release/Cygwin-Windows/cppapplication_3.exe
make[1]: Leaving directory '/cygdrive/c/Users/user/Documents/NetBeansProjects/CppApplication_3'
CLEAN SUCCESSFUL (total time: 1s)
"/usr/bin/make" -f nbproject/Makefile-Release.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory '/cygdrive/c/Users/user/Documents/NetBeansProjects/CppApplication_3'
"/usr/bin/make" -f nbproject/Makefile-Release.mk dist/Release/Cygwin-Windows/cppapplication_3.exe
make[2]: Entering directory '/cygdrive/c/Users/user/Documents/NetBeansProjects/CppApplication_3'
mkdir -p build/Release/Cygwin-Windows
rm -f build/Release/Cygwin-Windows/main.o.d
i686-pc-mingw32-g++ -E -c -O2 -I/usr/include -I/usr/include/apr-1 -I/usr/include/libxml2 -I/usr/include/boost -I/usr/local/apr -std=c++11 -MMD -MP -MF build/Release/Cygwin-Windows/main.o.d -o build/Release/Cygwin-Windows/main.o main.cpp
mkdir -p dist/Release/Cygwin-Windows
i686-pc-mingw32-g++ -E -o dist/Release/Cygwin-Windows/cppapplication_3 build/Release/Cygwin-Windows/main.o
i686-pc-mingw32-g++: warning: build/Release/Cygwin-Windows/main.o: linker input file unused because linking not done
make[2]: Leaving directory '/cygdrive/c/Users/user/Documents/NetBeansProjects/CppApplication_3'
make[1]: Leaving directory '/cygdrive/c/Users/user/Documents/NetBeansProjects/CppApplication_3'
BUILD SUCCESSFUL (total time: 1s)
-E選項很好奇。 man:「 - E在預處理階段後停止;不要運行編譯器。」 -c選項是正常的。請參閱http://stackoverflow.com/questions/2395158/linker-error-linker-input-file-unused-because-linking-not-done-undefined-ref – 2014-09-01 20:52:30
啊......我想知道爲什麼main.o如果這是預處理器之後的C++代碼,文件不會產生錯誤。它應該是不相容的輸入到鏈接器!? – 2014-09-01 20:55:17