I'm new to Linux. I wrote an application that uses MySQL, and its Makefile is posted as follows:
OBJ = main.o PeerDbOpMgr.o
MYSQL_INC = ./mysql/include
LNK_MYSQL = ./mysql/lib/ -lmysql
main : $(OBJ)
g++ -g -o main $(OBJ) -L$(LNK_MYSQL) -lpthread -lm
main.o : main.cpp
g++ -g -c -I$(MYSQL_INC) main.cpp
PeerDbOpMgr.o : PeerDbOp.cpp PeerDbOp.h
g++ -g -c -I$(MYSQL_INC) PeerDbOp.cpp -o PeerDbOpMgr.o
clean :
rm main $(OBJ)
I compiled it successfully. But when I ran it, it showed an an error:
./main: error while loading shared libraries: libmysql.so.16: cannot open shared object file: No such file or directory
The libmysql.so.16
file is under ./mysql/lib/libmysql.so.16
, but why does it says that there's no such file or directory?