0

我正在用 C++ 为 Oracle 编写一个方法。我使用 OCI 库和 Eclipse 作为我的 IDE。代码已完全编译,但出现此运行时错误:

"error while loading shared libraries: libocci.so.11.1: cannot open shared object file: No such file or directory "

我通过属性 > c/c++ 通用/路径和符号 > 库包含了 occi 和 clntsh 和 nnz11

我不知道如何解决这个错误,请帮助谢谢

4

3 回答 3

1

IDE不会像libocci.so.11.1那样你必须转换成像libocci.so

ln -s libocci.so.11.1

那么它将被重命名为 libocci.so

然后编译代码

于 2012-12-06T13:13:33.603 回答
0

哇 。最后我做到了,通过一个变量并将其放入 .bashrc

1- 导出 LD_LIBRARY_PATH=/opt/oracle/instantclient “库的路径”,然后 2- root@user:~# vi .bashrc “确保您在 root 中” 3- LD_LIBRARY_PATH=/opt/oracle/instantclient/ “将这两行添加到文件中“导出 LD_LIBRARY_PATH

:)

于 2012-08-05T10:52:05.107 回答
0

Your compiler finds the libraries because your project probably specifies where to look for libs (-L flag on the linker command line). But the runtime linker needs to find the libs as well.

I assume you're running it on linux. You have 2 options:

  1. A temporary solution is to define in your environment LD_LIBRARY_PATH=full path to dir where libocci.so* is installed. I'm not very familiar with eclipse, but there's likely a setting to change the runtime environment. You could also set LD_LIBRARY_PATH and then run ecplise in that env.

    $ export LD_LIBRARY_PATH=...

    $ command to run eclipse

  2. A permanent solution is to add the full path to the dir. where the libs are to the file /etc/ld.so.conf, or better: create a file /etc/ld.so.conf.d/oracle and put the path in that file, nothing else. Then, as root, run ldconfig.

于 2012-08-04T11:31:56.140 回答