I'm trying to link the mysql++ library with a simple program and am having some trouble.
The examples compile and run fine, so I hope it's something simple I've overlooked.
I'm using gcc and in my makefile I have the following lines to include the appropriate
mysql and mysql++ header files and libraries:
# path for mySQL header files
CCFLAGS += -I/usr/include/mysql
# path for mySQL++ header files
CCFLAGS += -I/usr/local/include/mysql++
# path for mySQL client library
LDFLAGS += -L/usr/lib/mysql -lmysqlclient
# path for mySQL++ library
LDFLAGS += -L/usr/local/lib -lmysqlpp
my program seems to compile and link fine. Here is part of the make output:
--- Linking /home/xanadu/test/bin/testProgram
/usr/bin/g++ /home/xanadu/test/src/testProgram.cc -L/usr/lib/mysql -lmysqlclient
-L/usr/local/lib -lmysqlpp -lnsl -lm -o /home/xanadu/test/bin/testProgram
Yet when I attempt to run the program, it appears unable to find the mysql++ library and
gives this error:
error while loading shared libraries: libmysqlpp.so.0: cannot open shared object file: No
such file or directory
Yet the libraries appear to be in /usr/local/lib where I told make they would be. Here's
my listing of the usr/local/lib directory:
[xanadu@xanadu src]$ ls -l /usr/local/lib
-rwxr-xr-x 1 root root 834 Aug 25 12:38 libmysqlpp.la
lrwxrwxrwx 1 root root 19 Aug 25 12:38 libmysqlpp.so -> libmysqlpp.so.0.2.0
lrwxrwxrwx 1 root root 19 Aug 25 12:38 libmysqlpp.so.0 -> libmysqlpp.so.0.2.0
-rwxr-xr-x 1 root root 1551825 Aug 25 12:38 libmysqlpp.so.0.2.0
What have I missed?
thanks again for your help!