编译C++使用SWI-Prolog接口的程序
Compiling C++ program that uses SWI-Prolog Interface
我正在编译这里找到的程序,在运行时出现错误:
这是我编译它的方法:
$ g++ -I/home/jpthomps/Desktop/pl-6.0.2/src main.cpp -L/usr/local/lib/swipl-6.0.2/lib/x86_64-linux -lswipl
main.cpp: In function ‘int main()’:
main.cpp:8:39: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
main.cpp:20:22: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
然后当我尝试运行编译的程序时:
$ ./a.out
./a.out: error while loading shared libraries: libswipl.so.6.0.2: cannot open shared object file: No such file or directory
我是否需要向我的.cpp文件添加一些内容以告诉它libswipl.so.6.0.2文件的位置?
您看到的问题与正在运行的a.out
无法找到您的动态库有关。有几种依赖于系统的方法来处理此问题。例如,在 Linux 上,您可以将LD_LIBRARY_PATH
设置为包含libswipl.so.6.0.2
所在的目录。
尽管编译警告与运行时错误无关,但修复它们仍然是一个好主意:
static const char * av[] = {"calc.pl", NULL};
....
const char * expression = "pi/2";
相关文章:
- 带有进度表的 curl 多接口程序
- 使用没有堆内存分配的接口的框架应用程序?
- 在C LIB和程序中具有相同接口的类.EXE版本是
- 将C 应用程序(无接口,仅算法)移植到Android
- 使用Microsoft安全支持提供程序接口 (SSPI) 对消息进行加密和签名
- Create_task():称为“接口”的应用程序,该接口已编辑为其他线程进行编组
- 在没有包装程序类的情况下,在ActiveX接口上调用方法
- QT应用程序接口冻结
- 在自定义 C/C++ 程序中获取 PPP0 接口 Tx/Rx 字节的最简单方法是什么?
- 当从一个应用程序调用时,在DLL方法中创建COM接口指针是有效的,但当从另一个应用软件调用时则无效
- 创建 COM 接口指针在开发计算机上有效,但会导致其他计算机上的应用程序崩溃
- 为什么C++应用程序不能创建像php,html和css这样的接口?
- 在主应用程序中声明的 dll 中实现接口 - C++
- MFC功能区接口在本地化应用程序时发出断言失败
- 我的C++应用程序如何调用驱动程序的接口
- 编译C++使用SWI-Prolog接口的程序
- 我可以在Qt应用程序中使用现有的本机Windows COM接口吗
- 安装程序设备接口错误 259 用于显示
- C++程序在调用C#接口时接收HOST_E_CLRNOTAVAILABLE
- 与VBA应用程序接口