c - Linking with ld/gcc doesn't produce same result (error/sucess) -
i have problem, after compilation wan't link using ld when error lets see do:
make i386 gcc -g -c -i. -i/usr/include -o p_test.o.i386 pkcs11test.c ld -o p_test.i386 p_test.o.i386 -g -ldl ld: p_test.o.i386: référence au symbole non défini «fflush@@glibc_2.0» //lib/i386-linux-gnu/libc.so.6: error adding symbols: dso missing command line make: *** [i386_p_test] erreur 1
so ld got error when try gcc
make i386 gcc -g -c -i. -i/usr/include -o p_test.o.i386 pkcs11test.c gcc -o p_test.i386 p_test.o.i386 -g -ldl
i got no error , executable
do know how can make ld work linking program ?
thanks !
when start gcc gcc -o p_test.i386 p_test.o.i386 -g -ldl
, adds lot internal libraries ld
command. can see arguments adding -v
option gcc. 1 of "internal library" glibc (-lc
).
for example, here gcc verbose mode output explanation can see collect2
program used link executable. there -lgcc -lgcc_eh -lc -lgcc -lgcc_eh
libraries added run , several crt runtime objects linked too:
/usr/lib/gcc-lib/i686/3.3.1/collect2 --eh-frame-hdr -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/gcc-lib/i686/3.3.1/crtbegin.o -l/usr/lib/gcc-lib/i686/3.3.1 -l/usr/lib/gcc-lib/i686/3.3.1/../../.. /tmp/ccqynbtm.o # << input file. -lgcc -lgcc_eh -lc -lgcc -lgcc_eh /usr/lib/gcc-lib/i686/3.3.1/crtend.o /usr/lib/crtn.o
ps: think better not change file extensions (suffixes). p_test.o.i386
can renamed p_test.i386.o
Comments
Post a Comment