How do i configure g++ to look into particular directory to search library fles?
Hi.. I dont have permission to install on the disk. My program needs to link to mysql DB. I copied the Mysql.h and rest headerrs to local folder and ran the program. While executing, the program throws an error sayin
./a.out: error while loading shared libraries: libmysqlclient.so.16: cannot open shared object file: No such file or directory. I tried setting the LD_LIBRARY_PATH variable, but dint help. please help me how to go about it. thanks in advance. |
g++ man page or the gcc docs.
Code:
-llibrary Code:
-Ldir Code:
g++ -L/path/to/library -lmysqlclient ... |
I tried but is still throwing the same error. I also tried setting the environmental variable LIBRARY_PATH.
Thanks |
The environment variable is LD_LIBRARY_PATH. ld is the dynamic linkers, which resolves libraries at runtime whereas the compiler only needs them to link the final executable. You can compile an executable statically (with the -static flag) assuming all required libraries exist statically on the disk (as .a files, not .so files). This was, the program will have no external library dependencies at a cost of a (potentially much) larger binary.
|
@btmiller, the library file tat is not bein located is .so..can i use static flag while compiling??
thanks |
You will need the static library, which is usually supplied in the -devel package version. Actually, the devel versions of dependencies is usually needed when compiling from source.any way. The static library versions have .a extensions.
|
All times are GMT -5. The time now is 03:19 PM. |