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
相关推荐
czhc114007566310 小时前
数据库520 HALCONAN安装
数据库
阿坤带你走近大数据10 小时前
Oracle中的OGG介绍
数据库·oracle
Ether IC Verifier10 小时前
TCP/IP协议握手原理详解——结合以太网连接过程
服务器·网络·数据库·网络协议·tcp/ip
乐观的Terry10 小时前
博客系统全文搜索实战:用 Elasticsearch 告别 MySQL LIKE 查询
mysql·elasticsearch
宋浮檀s10 小时前
SQL注入基础+DVWA搭建
数据库·sql·安全·网络安全
Amarantine、沐风倩✨10 小时前
Oracle 性能排查:通过 V$LONG_EXEC_SQLS 快速定位慢 SQL
数据库·sql·oracle
倔强的石头10610 小时前
生产环境排坑实录:SQL 标量子查询的“静默杀手”与优化器的智能推演
数据库·sql
jnrjian10 小时前
控制用户alter user 修改密码的两种办法 dbv and triggers
数据库·oracle
米高梅狮子10 小时前
01.mysql的备份与恢复
运维·数据库·mysql·docker·容器·kubernetes·github