soci gives fatal error: mysql.h: No such file or directory

594 Views Asked by At

When I am trying to compile a program that is using SOCI library I get:

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

I've checked and I have mysql.h in:

/usr/include/mysql

My CMakeLists file is:

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)

I've tried to add:

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

but I get that there is no package configuration file.

I've also tried to reinstall soci and mysql connector.

1

There are 1 best solutions below

0
Robert-Nicolae Solca On BEST ANSWER