查看mysql.h和libmysqlclient.so的路径
bash
eik@eik-Virtual-Machine:~/桌面/dbpool/bin$ locate mysql.h
/usr/include/mysql/mysql.h
eik@eik-Virtual-Machine:~/桌面/dbpool/bin$ locate libmysqlclient.so
/usr/lib/x86_64-linux-gnu/libmysqlclient.so
/usr/lib/x86_64-linux-gnu/libmysqlclient.so.21
/usr/lib/x86_64-linux-gnu/libmysqlclient.so.21.2.35
如果找不到,则安装
bash
sudo apt-get update
apt-cache search libmysql
sudo apt-get install libmysqlclient-dev libmysql++-dev
添加到CMakeLists.txt中
txt
include_directories(/usr/include/mysql)
link_directories(/usr/lib/x86_64-linux-gnu)
target_link_libraries(xxx libmysqlclient.so)