ld的問題 - Linux

Table of Contents


我寫了一個簡單的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

--

All Comments

Tristan Cohan avatarTristan Cohan2008-11-22
gcc -v xxx.c 可以看它執行的詳細動作