ubuntu22.04 cmake 配置mysql

报错信息:

CMake Error at CMakeLists.txt:33 (find_package):

By not providing "FindMySQL.cmake" in CMAKE_MODULE_PATH this project has

asked CMake to find a package configuration file provided by "MySQL", but

CMake did not find one.

Could not find a package configuration file provided by "MySQL" with any of

the following names:

复制代码
MySQLConfig.cmake
mysql-config.cmake

Add the installation prefix of "MySQL" to CMAKE_PREFIX_PATH or set

"MySQL_DIR" to a directory containing one of the above files. If "MySQL"

provides a separate development package or SDK, be sure it has been

installed.

解决方法:

cmakelist中,添加类似的语句:
!!!!!其中/usr/include/mysql 和 test.app要适当更改!!!!!

cpp 复制代码
include_directories(/usr/include/mysql)
target_link_libraries(test.app mysqlclient)

其它问题:

如有其它问题,请先排查是否正确安装MySQL和API:

API 安装:

bash 复制代码
sudo apt-get update
sudo apt-get install libmysql++-dev
sudo apt-get install libmysqlclient-dev
相关推荐
czlczl200209258 小时前
Redis数据编码
数据库·redis·缓存
Wpa.wk8 小时前
pb协议接口测试
数据库·redis·缓存
IpdataCloud8 小时前
资源受限设备上轻量级IP查询模块的部署方法
网络·数据库·网络协议·tcp/ip
青槿吖8 小时前
SpringMVC通关秘籍(下):日期转换器、拦截器与文件上传的奇幻冒险
java·开发语言·数据库·sql·mybatis·状态模式
楼田莉子8 小时前
MySQL数据库:表及其表相关的操作
数据库·学习·mysql
ZTLJQ8 小时前
驾驭高并发:Python协程与 async/await 完全解析
服务器·数据库·python
百年੭ ᐕ)੭*⁾⁾8 小时前
DataFrame存入mysql以及读取操作
数据库·mysql·numpy·pandas·ipython
²º²²এ松9 小时前
vs code连接ubuntu esp项目
linux·数据库·ubuntu
Maverick069 小时前
02-SQL执行计划与优化器:Oracle是怎么决定“该怎么查“的
数据库·sql·oracle·ffmpeg