2013-04-02 170 views
1

的Netbeans 7.3 GCC 4.5.3Makefile文件無法編譯文件

我看了一些這個問題的答案,但我看不到我的具體情況。

由Netbeans生成的makefile似乎是正確的。在Netbeans終端窗口中給出的輸出給出了一個No rule to make target ReadList.cpp,這似乎是錯誤的。我無法弄清楚發生了什麼事。

輸出窗口顯示:

"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf 
make[1]: Entering directory `/c/home/skidmarks/Projects/SLIP/slip' 
"/usr/bin/make" -f nbproject/Makefile-Debug.mk dist/Debug/Cygwin_4.x-Windows/slip.exe 
make[2]: Entering directory `/c/home/skidmarks/Projects/SLIP/slip' 
make[2]: *** No rule to make target `ReadList.cpp', needed by `build/Debug/Cygwin_4.x-Windows/ReadList.o'. Stop. 
make[2]: Leaving directory `/c/home/skidmarks/Projects/SLIP/slip' 
nbproject/Makefile-Debug.mk:94: recipe for target `.build-conf' failed 
make[1]: *** [.build-conf] Error 2 
make[1]: Leaving directory `/c/home/skidmarks/Projects/SLIP/slip' 
nbproject/Makefile-impl.mk:39: recipe for target `.build-impl' failed 
make: *** [.build-impl] Error 2 


BUILD FAILED (exit value 2, total time: 375ms) 

Makefile中顯示:

${OBJECTDIR}/SlipReadList.o: SlipReadList.cpp 
    ${MKDIR} -p ${OBJECTDIR} 
    ${RM} [email protected] 
    $(COMPILE.cc) -g -w -MMD -MP -MF [email protected] -o ${OBJECTDIR}/SlipReadList.o SlipReadList.cpp 

生成文件似乎正確,適用於其他文件。我已驗證.cpp和.h文件與其他已成功編譯的文件位於同一目錄中,並位於同一目錄中。任何人有一個想法是什麼問題?

+0

那麼錯誤表示缺少的文件是ReadList.cpp而不是SlipReadList.cpp – john

+0

那麼有幫助。我沒有ReadList.cpp(但我認爲你已經解決了我的問題),簽名和感謝。 –

回答

0
make[2]: *** No rule to make target `ReadList.cpp', needed by `build/Debug/Cygwin 

現在看看你的make文件:

${OBJECTDIR}/SlipReadList.o: SlipReadList.cpp 

你有readlist.cpp最初,但在makefile想要一個SlipReadList.cpp。因此,編譯器不知道如何處理readlist.cpp。一個簡單的解決方法是將文件的命名更改爲SlipReadList.cpp