I am trying to get the mysql connection working on a c++ cgi program. I installed on osx with brew the mysql-client and mysql++. But when i try to compile the program the following error appears:
<code>/opt/homebrew/Cellar/mysql++/3.3.0_3/include/mysql++/null.h:174:7: error: field has incomplete type 'mysqlpp::String'
Type data;
</code>
<code>/opt/homebrew/Cellar/mysql++/3.3.0_3/include/mysql++/null.h:174:7: error: field has incomplete type 'mysqlpp::String'
Type data;
</code>
/opt/homebrew/Cellar/mysql++/3.3.0_3/include/mysql++/null.h:174:7: error: field has incomplete type 'mysqlpp::String'
Type data;
This is my cmakelists.txt
<code>cmake_minimum_required(VERSION 3.28)
project(helloworld4)
set(CMAKE_CXX_STANDARD 23)
file(REMOVE_RECURSE ${CMAKE_BINARY_DIR}/www)
file(COPY www DESTINATION ${CMAKE_BINARY_DIR})
include_directories(/opt/homebrew/Cellar/mysql++/3.3.0_3/include/mysql++)
include_directories(/opt/homebrew/opt/mysql-client/include/mysql)
find_library(MYSQLPP_LIB REQUIRED mysqlpp /opt/homebrew/Cellar/mysql++/3.3.0_3/lib)
find_library(MYSQLCLIENT_LIB REQUIRED mysqlclient /opt/homebrew/opt/mysql-client/lib)
add_executable(helloworld4 main.cpp)
target_link_libraries(helloworld4 ${MYSQLPP_LIB} ${MYSQLCLIENT_LIB})
</code>
<code>cmake_minimum_required(VERSION 3.28)
project(helloworld4)
set(CMAKE_CXX_STANDARD 23)
file(REMOVE_RECURSE ${CMAKE_BINARY_DIR}/www)
file(COPY www DESTINATION ${CMAKE_BINARY_DIR})
include_directories(/opt/homebrew/Cellar/mysql++/3.3.0_3/include/mysql++)
include_directories(/opt/homebrew/opt/mysql-client/include/mysql)
find_library(MYSQLPP_LIB REQUIRED mysqlpp /opt/homebrew/Cellar/mysql++/3.3.0_3/lib)
find_library(MYSQLCLIENT_LIB REQUIRED mysqlclient /opt/homebrew/opt/mysql-client/lib)
add_executable(helloworld4 main.cpp)
target_link_libraries(helloworld4 ${MYSQLPP_LIB} ${MYSQLCLIENT_LIB})
</code>
cmake_minimum_required(VERSION 3.28)
project(helloworld4)
set(CMAKE_CXX_STANDARD 23)
file(REMOVE_RECURSE ${CMAKE_BINARY_DIR}/www)
file(COPY www DESTINATION ${CMAKE_BINARY_DIR})
include_directories(/opt/homebrew/Cellar/mysql++/3.3.0_3/include/mysql++)
include_directories(/opt/homebrew/opt/mysql-client/include/mysql)
find_library(MYSQLPP_LIB REQUIRED mysqlpp /opt/homebrew/Cellar/mysql++/3.3.0_3/lib)
find_library(MYSQLCLIENT_LIB REQUIRED mysqlclient /opt/homebrew/opt/mysql-client/lib)
add_executable(helloworld4 main.cpp)
target_link_libraries(helloworld4 ${MYSQLPP_LIB} ${MYSQLCLIENT_LIB})
There are no messages from cmake that the libraries couldnt be found but i still get this error.