This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

One interesting question !?


Dear Sir/Madam,

Do you know why only the method #2 listed below can work ?
Nevertheless, some other library like "mysqlclient" can work without any problem although I put it like "cc -I./ -L/usr/lib/mysql -lmysqlclient testc.c -o test -laaa" or "cc -I./ -L/usr/lib/mysql testc.c -o test -laaa  -lmysqlclient ".

Method #1:
[root@etc-server temp]# cc -I./ -L./ -lmylib testc.c -o test
/tmp/ccIJ9zcX.o: In function `main':
/tmp/ccIJ9zcX.o(.text+0x7): undefined reference to `testlib'	<-- "testlib" is one function in this library for testing !!
collect2: ld returned 1 exit status

Method #2:
[root@etc-server temp]# cc -I./ -L./ -lmylib testc.c -o test -laaa

Remark: I used the commands "ar qa libmylib.a myobject1.o myobjectn.o; ranlib libmylib.a" to create my library.

THANKS !!

Best Regards. Louie

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]