ld 指令問題 - Linux

Table of Contents


請問一下 我在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指令

謝謝

--

All Comments

Selena avatarSelena2015-12-14
http://goo.gl/4uiLaI google "ld asm with c" 就有了
Skylar DavisLinda avatarSkylar DavisLinda2015-12-16
?
Ursula avatarUrsula2015-12-21
抱歉噓錯篇