I am compiling the program found here, and at runtime I get an error:
Here is what I do to compile it:
$ 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]
Then when I try to run the compiled program:
$ ./a.out
./a.out: error while loading shared libraries: libswipl.so.6.0.2: cannot open shared object file: No such file or directory
Do I need to add something to my .cpp file to tell it where the libswipl.so.6.0.2 file is located?
The problem that you see is related to the inability of the running
a.outto find your dynamic library. There are several system-dependent ways to deal with the issue. For example, on Linux you can setLD_LIBRARY_PATHto include the directory wherelibswipl.so.6.0.2is located.Although the compilation warnings are not related to the runtime error, it is still a good idea to fix them: