Pregunta

I'm not sure if I'm asking this question the right way, but I have recently tried to make an application that uses mysql/c++

I compile the program like this:

g++ -o test main.cpp -I./include -L./lib -lmysqlclient -lmysqlcppconn

and when I run the program it responds the following:

dyld: Library not loaded: /home/myname/Desktop/path/to/exe
  Referenced from: /Users/myname/Desktop/path/to/./test
  Reason: image not found
Trace/BPT trap: 5

Can anyone seee what I might be doing wrong?

Thanks in advance, and let me know if more info about the problem is needed.

¿Fue útil?

Solución

I can only guess your mysql libraries are not located in a standard place.
If you want to keep your libraries in a non standard place, you should set the environment variable DYLD_LIBRARY_PATH to point to your dynamic link libraries.
Under linux/most unices that would be LD_LIBRARY_PATH.

So something like:

export DYLD_LIBRARY_PATH="${DYLD_LIBRARY_PATH}:./lib";
./yourExecHere

Should do the trick.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top