./ProjectC: error while loading shared libraries: libProjectC.so: cannot open shared object file: No such file or directory

时间: 2014-7-20   11:30

地点: andon

问题: 研究xu库文件的创建,编译-链接通过后,执行文件时./ProjectC

        ./ProjectC: error while loading shared libraries: libProjectC.so: cannot open shared object file: No such file or directory

         不能打开动态链接库

解决:makefile文件中,库文件 libProjectC.so已经添加到./install中,但还是报错

        #lib directory
         LIBDIR = -L ./
         LIBDIR = -L ../install

         #lib which the link program need
         LIBS = $(LIBDIR) -l$(PROJECT)
         LIBS += -lpthread
         LIBS += -lProjectA

         最后发现是/etc/ld.so.conf中未添加路径/root/workspace/Project/install

         include ld.so.conf.d/*.conf
         /usr/local/lib
         /root/workspace/Project/install

         添加路径后,shell:ldconfig

         重新编译即可成功

posted @ 2014-07-20 11:39  柠檬恋上雨  阅读(173)  评论(0编辑  收藏  举报