2013年8月31日星期六

linux C programming, how to use so file

/ Usr/lib/libfreeimage.so.3
/ usr / lib / libfreeimage.a
/ usr/lib/libfreeimage-3.15.4.so
/ usr / lib / libfreeimage.so
As shown above, a variety of so files in these folders, but the problem is this when compiling gcc freeimage.c-lfreeimage -I/usr/include /-o freeimage, appeared One problem is that error while loading shared libraries: libfreeimage.so.3: cannot open shared object file: No such file or directory, obviously already connected to / usr / lib / folder, but it still will not
------ Solution ----------------------------- ---------------
ls-la / usr / lib / libfreeimage *
results posted to look
------ Solution ------------------------------- -------------
export LD_LIBRARY_PATH = / usr / lib: $ (LD_LIBRARY_PATH)
------ For reference only --------- ------------------------------
-rwxr-xr-x 1 root root 3679528 Aug 12 10:22 / usr/lib/libfreeimage-3.15.4.so
-rw-r - r - 1 root root 6765130 Aug 12 10:22 / usr / lib / libfreeimage.a
lrwxrwxrwx 1 root root 17 Aug 12 10:22 / usr / lib / libfreeimage.so -> libfreeimage.so. 3
lrwxrwxrwx 1 root root 22 Aug 12 10:22 / usr/lib/libfreeimage.so.3 -> libfreeimage- 3.15.4.so
------ For reference only --------------------------------- ------
gcc freeimage.c-lfreeimage -I/usr/include /-o freeimage -L/usr/lib
------ For reference only ---------------------------------------

usr/lib/libfreeimage.a  //静态库
/usr/lib/libfreeimage-3.15.4.so  //动态库
/usr/lib/libfreeimage.so

编译的时候 -L 选项 引导库 然后跟上路径就好了

- ---- For reference only ---------------------------------------
4 Can building specific points, as the third floor, I have tried, or not. Compiler is passed, but when running problem.
------ For reference only -------------------------------------- -
I meant to say, before the compile time can pass, that is the problem at run time, not later compiled successfully, to the point, please, ladies and Great God
------ For reference only ---------------------------------------
really can, powerful, Thank you, grateful, but is not very clear reason, this is the environment variable bar, so write the future is not long-term.
------ For reference only -------------------------------------- -
say is on the 7th floor master
------ For reference only --------------------------- ------------

not a long-term, only on the current environment, the LD_LIBRARY_PATH written in the boot script, or modify the configuration files under the dynamic library
online search under linux dynamic library link path, a lot of information

没有评论:

发表评论