[問題] linux 中 ld 指令問題

看板C_and_CPP作者 (5566 超強)時間8年前 (2015/12/09 19:03), 編輯推噓1(101)
留言2則, 2人參與, 最新討論串1/1
開發平台(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

12/09 20:56, , 1F
感覺一個 32 一個 64 位元?
12/09 20:56, 1F

12/10 09:00, , 2F
readelf看一下兩個.o file是不是同一個架構?
12/10 09:00, 2F
文章代碼(AID): #1MQ0fj2k (C_and_CPP)