Adding a library

Ingo Krabbe ikrabbe.ask@web.de
Tue Jun 20 04:41:00 GMT 2006


Am Dienstag, 20. Juni 2006 04:59 schrieb Vivek Katakam:
> Hi All,
> I have a problem at Linker stage in the compilation process.
>
> If I include libsqlplus.so as -lsqlplus it is generating the binary
> otherwise it is the giving undefined reference to sqlca function.
>
> I have also given the LD_LIBRARY_PATH etc. Because I have to change at
> lot number of places , is there a way around so that i can dynamically
> include this library for example through ranlib.


have you tried -Wl,-rpath,[PATH TO libsqlplus] as a LDFLAG while linking ?  
Then you don't need to set LD_LIBRARY_PATH in your environment, but the 
binary will know on its own how to find the library.  You have to think twice 
about this topic, when you want to enable others to use your project to make 
the executables.  In general, all linker options are accesible through 
gcc's -Wl flag followed by the linker flag.

>
> Regards,
> Vivek



More information about the Gcc-help mailing list