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
相关推荐
天地之于壹炁兮14 分钟前
编程I/O入门指南:核心操作全解析
数据库·windows·microsoft
切糕师学AI22 分钟前
SQL中的函数索引/表达式索引
数据库·sql·mysql·postgresql·oracle
武子康31 分钟前
Java-166 Neo4j 安装与最小闭环 | 10 分钟跑通 + 远程访问 Docker neo4j.conf
java·数据库·sql·docker·系统架构·nosql·neo4j
S_h_a_1 小时前
八股-Mysql 基础篇(1)
数据库·mysql
Dxy12393102161 小时前
MySQL的GROUP_CONCAT函数详解
数据库·mysql
编啊编程啊程1 小时前
【029】智能停车计费系统
java·数据库·spring boot·spring·spring cloud·kafka
Leon-Ning Liu2 小时前
Oracle数据库常用视图:dba_datapump_jobs
数据库·oracle·dba
数据库生产实战2 小时前
Oracle 19C RAC下TRUNCATE TABLE的REUSE STORAGE选项作用和风险浅析!
数据库·oracle
小白银子3 小时前
零基础从头教学Linux(Day 60)
linux·数据库·mysql·oracle
瀚高PG实验室3 小时前
数据库安全配置指导
服务器·数据库·瀚高数据库