2017-01-30 35 views
0

我試着在我的c源代碼上使用make並創建可執行文件。但可執行文件不能用於預期的任務。即使make文件編譯,生成的可執行文件,當我嘗試編譯.c文件單獨它給了很多不確定的參考問題 的錯誤是如何在Linux中使用「make和building executables」工作

/tmp/cc4tx0BG.o: In function `main': 
cubist.c:(.text+0xdc): undefined reference to `Of' 
cubist.c:(.text+0xe7): undefined reference to `Of' 
cubist.c:(.text+0xfa): undefined reference to `Of' 
cubist.c:(.text+0x10f): undefined reference to `KRInit' 
cubist.c:(.text+0x114): undefined reference to `ExecTime' 
cubist.c:(.text+0x127): undefined reference to `PrintHeader' 
cubist.c:(.text+0x139): undefined reference to `Of' 
[...] 
cubist.c:(.text+0xb79): undefined reference to `MaxAtt' 
cubist.c:(.text+0xb83): undefined reference to `InitialiseEnvData' 
cubist.c:(.text+0xb8a): undefined reference to `XVAL' 
cubist.c:(.text+0xb93): undefined reference to `CrossVal' 
cubist.c:(.text+0xb9a): undefined reference to `SingleCttee' 
cubist.c:(.text+0xb9f): undefined reference to `ExecTime' 
cubist.c:(.text+0xbab): undefined reference to `Of' 
collect2: error: ld returned 1 exit status 

請,可以在任何身體告訴用就怎麼做和建築Linux中的可執行文件。

+1

減少輸出,從第10行開始會發生什麼情況是可以理解的。 – 0andriy

+0

我認爲這是一個鏈接錯誤。你是如何編譯你的源代碼的? – uzsolt

+0

我使用gcc編譯器來獲取名爲cubist的可執行文件。 gcc -o cubist cubist.c – melaku

回答

0

認爲(不知道)你說你成功生產用make(至少這是我如何理解「使用讓我的C源代碼和生成的可執行文件」的執行 - 做,如果指正我錯了!)。如果是這種情況,請調用make:make -B --trace,您將看到用於構建可執行文件的確切命令,然後您將希望知道在嘗試手動構建某些內容時錯過了哪個編譯器/鏈接器標記或庫。

相關問題