GCC undefined object reference

Jonathan Wakely jwakely.gcc@gmail.com
Thu Aug 11 12:36:00 GMT 2011

On 11 August 2011 12:36, manaankit2 wrote:
> Hello,
> I have a c file which uses the function defined in a library. In my makefile
> i am providing the -lCOM option with gcc. Where COM is the library. The
> Library Path is there in the LD_LIBRARY_PATH.
> But when i run the gmake, i get the error which says that undefined Object
> reference.
> That function is there in the COM lib(libCOM.a).
> Can someone help me with the same?

This is not really a gcc question, it's about your linker.

On some platforms (e.g. Solaris) the linker will look in
LD_LIBRARY_PATH, on others (e.g. GNU/Linux) it won't and you need to
use -L to specify the directory containing libCOM.a

More information about the Gcc-help mailing list