2010-10-30 78 views
0

我剛剛以爲我解決了a problem,但它似乎又出現了另一個 - 或者至少在另一種形式中出現了同樣的問題。現在,當我嘗試重建一切,在回答這個問題的建議,所有Qt Creator中顯示的建立問題是一個行collect2: ld returned 1 exit status對成員函數的未定義引用

下面是一些編譯輸出,我認爲可能是相關的:

Running build steps for project Othello-cmd... 
Starting: "C:/Qt/2010.05/mingw/bin/mingw32-make.exe" clean -w 
[snipped] 
C:/Qt/2010.05/mingw/bin/mingw32-make -f Makefile.Release clean 

Could Not Find C:\Users\Amos Ng\My Dropbox\School\College\2010.. Fall\CS 3A\Othello-cmd-build-desktop\debug\main.o   //this was in red 

mingw32-make[1]: Entering directory `C:/Users/Amos Ng/My Dropbox/School/College/2010.. Fall/CS 3A/Othello-cmd-build-desktop' 

del release\main.o release\board.o release\player.o release\referee.o release\misc.o release\humanplayer.o release\computerplayer.o release\chatter.o release\chatserver.o release\location.o 
mingw32-make[1]: Leaving directory `C:/Users/Amos Ng/My Dropbox/School/College/2010.. Fall/CS 3A/Othello-cmd-build-desktop' 

mingw32-make: Leaving directory `C:/Users/Amos Ng/My Dropbox/School/College/2010.. Fall/CS 3A/Othello-cmd-build-desktop' 

Could Not Find C:\Users\Amos Ng\My Dropbox\School\College\2010.. Fall\CS 3A\Othello-cmd-build-desktop\release\main.o 

//these next 3 lines are in blue 
The process "C:/Qt/2010.05/mingw/bin/mingw32-make.exe" exited normally. 
Configuration unchanged, skipping qmake step. 
Starting: "C:/Qt/2010.05/mingw/bin/mingw32-make.exe" -w 
mingw32-make: Entering directory `C:/Users/Amos Ng/My Dropbox/School/College/2010.. Fall/CS 3A/Othello-cmd-build-desktop' 
[snipped] 
//A bunch of lines similar to 
g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"c:\Qt\2010.05\qt\include\QtCore" -I"c:\Qt\2010.05\qt\include" -I"c:\Qt\2010.05\qt\include\ActiveQt" -I"debug" -I"\\psf\Dropbox\School\College\2010.. Fall\CS 3A\Othello-cmd" -I"." -I"c: "filepath of .o file" "filepath of .cpp file" 

g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -Wl,-subsystem,console -mthreads -Wl -o debug\Othello-cmd.exe object_script.Othello-cmd.Debug -L"c:\Qt\2010.05\qt\lib" -lQtCored4 

//everything's red starting here... 

./debug\board.o://psf/Dropbox/School/College/2010.. Fall/CS 3A/Othello-cmd/board.cpp:29: undefined reference to `OPiece::OPiece(int)' 

./debug\board.o://psf/Dropbox/School/College/2010.. Fall/CS 3A/Othello-cmd/board.cpp:39: undefined reference to `OPiece::flip()' 

./debug\board.o://psf/Dropbox/School/College/2010.. Fall/CS 3A/Othello-cmd/board.cpp:76: undefined reference to `OPiece::display()' 

./debug\board.o://psf/Dropbox/School/College/2010.. Fall/CS 3A/Othello-cmd/board.cpp:110: undefined reference to `OPiece::display()' 

./debug\board.o://psf/Dropbox/School/College/2010.. Fall/CS 3A/Othello-cmd/board.cpp:159: undefined reference to `OPiece::OPiece(int)' 

//couple more lines just like the above 

collect2: ld returned 1 exit status 

//...finally things are black again 

mingw32-make[1]: Leaving directory `C:/Users/Amos Ng/My Dropbox/School/College/2010.. Fall/CS 3A/Othello-cmd-build-desktop' 

mingw32-make: Leaving directory `C:/Users/Amos Ng/My Dropbox/School/College/2010.. Fall/CS 3A/Othello-cmd-build-desktop' 

//everything's red again 

mingw32-make[1]: *** [debug\Othello-cmd.exe] Error 1 

mingw32-make: *** [debug] Error 2 

The process "C:/Qt/2010.05/mingw/bin/mingw32-make.exe" exited with code %2. 
Error while building project Othello-cmd (target: Desktop) 
When executing build step 'Make' 

關於什麼可能導致此錯誤的任何想法?

編輯:我也想指出,我沒有找到「main.o」調試目錄內...

SOLUTION(不是真的):我在Netbeans的重新編譯的一切,而不是(上儘管Mac,所以也許連接器是不同的......)。現在程序運行良好...再見Qt Creator

回答

1

我會盡量猜測。您要麼使用命名空間錯誤(即將#include僞指令放在命名空間的主體中)。或者您還沒有完全按照您的建議刪除調試和發佈目錄。

+0

我懷疑你可能是對的!我沒有在任何命名空間中放置任何包含指令(我只有一個,所以我非常確定),但是我找不到所有的.o文件在哪裏!顯然,\ Othello-cmd-build-desktop \ debug包含舊的.o文件;在我全部刪除之後,建設/重建項目並沒有讓他們重新出現。我真的沒有看到他們可以在哪裏... – wrongusername 2010-10-30 04:17:26

+0

我只是嘗試刪除othello-cmd-build-desktop文件夾。除了某些錯誤消息的排序外,沒有任何東西似乎發生了變化,而且我得到一個「Could not Find C:\ Users \ Amos Ng \ My Dropbox \ School \ College \ 2010 .. Fall \ CS 3A \ Othello- cmd-build-desktop \ release \ main.o「消息,而不是之前的兩個。 – wrongusername 2010-10-30 04:20:41

+0

aww很棒......我剛剛意識到,在刪除文件夾之後,再也沒有othello-cmd-build-desktop文件夾。哪裏都是.o文件? – wrongusername 2010-10-30 04:28:01