This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
One interesting question !?
- From: "Louie Chan" <louie at unitednet dot com dot hk>
- To: <gcc at gcc dot gnu dot org>
- Date: Wed, 1 Jan 2003 11:40:36 +0800
- Subject: 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