看板 C_and_CPP 關於我們 聯絡資訊
開發平台(Platform): (Ex: VC++, GCC, Linux, ...) linux 請問一下 我在ubuntu 14版 64位元下 想要用ld 連結兩個 .o檔案 foo.o是C語言 bar.o是組語編出來的 我想要連結兩個檔案 輸入 ld -s -o foobar foo.o bar.o 發生下面的問題 ld: i386 architecture of input file `foo.o' is incompatible with i386:x86-64 output 爬網路改起來是要改用 elf_i386 於是改為 ld -m elf_i386 -s -o foobar foo.o bar.o 一樣還是有相同的問題 但是單獨使用 ld -m elf_i386 -o hello hello.o 這樣可以 想問一下兩個檔案連結要怎麼使用ld指令 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 218.161.13.208 ※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1449658989.A.0AE.html
MinamiChiaki: 感覺一個 32 一個 64 位元? 12/09 20:56
christianSK: readelf看一下兩個.o file是不是同一個架構? 12/10 09:00