Simple linking problem

John (Eljay) Love-Jensen eljay@adobe.com
Thu May 10 11:40:00 GMT 2007


Hi gccNewbie,

>So it is really a very simple riddle. 'gcc -lmylib mysource.c' uses a function 'foo' which nm shows is defined in libmylib.a. gcc does not complain about not being able to find mylib, but it does complain that 'foo' is an 'undefined reference'. In what situation could that happen?

Dependency order is important.

What happens when you do:

gcc mysource.c -lmylib

HTH,
--Eljay



More information about the Gcc-help mailing list