[問題] ld的問題

看板Linux作者 (allstars)時間17年前 (2008/11/21 12:41), 編輯推噓1(100)
留言1則, 1人參與, 最新討論串1/1
我寫了一個簡單的pthread problem 通常是要用 $>cc -lpthread pthread.c 來產生executable 那如果我想link時用ld的話 $>cc -c pthread.c $>ld --entry=main -lpthread pthread.o -o pthread 但其實這樣並不能執行 $>file pthread pthread: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), not stripped 通常正常的結果會是 : ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.6.8, dynamically linked (uses shared libs), not stripped 請問ld是還要加什麼東西呢??? thanks -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 203.67.242.96

11/21 12:52, , 1F
gcc -v xxx.c 可以看它執行的詳細動作
11/21 12:52, 1F
文章代碼(AID): #199ZmD6g (Linux)
文章代碼(AID): #199ZmD6g (Linux)