soci给出致命错误:mysql.h:没有这样的文件或目录



当我试图编译一个使用SOCI库的程序时,我得到:

/usr/local/include/soci/mysql/soci-mysql.h:31:10: fatal error: mysql.h: No such file or directory

我已经检查过了,我有mysql.h在:

/usr/include/mysql

我的CMakeLists文件是:

cmake_minimum_required(VERSION 3.10)
add_definitions(-DUNICODE -D_UNICODE)
project(server)
find_package(Threads REQUIRED)
include_directories(include
../Third-party/SimpleIni
../Shared/Logger
../Shared/Communication-Protocol     
)
file(GLOB SOURCES "src/*.cpp")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_HOME_DIRECTORY}/bin)
add_executable(${PROJECT_NAME} ${SOURCES})
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 17)
target_link_libraries(${PROJECT_NAME} pthread soci_core soci_mysql)
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra)

我试着添加:

find_package(mysql REQUIRED)
include_directories (${MYSQL_INCLUDE_DIR})

但我发现没有包配置文件。

我还试着重新安装了soci和mysql连接器。

我已经通过使用这个解决了这个问题:https://github.com/Gancc123/flame-sp/blob/c8108823dea205e25abac03942534996710109f3/cmake/modules/Findmysql.cmake

相关内容

  • 没有找到相关文章

最新更新