Clion import mysql database (absolutely make you satisfied epic tutorial) Win environment

I searched the entire network, basically no one to write clion import mysql library under windows, own fiddle for a long time, we can save some efforts now

Directly attached to the code

cmake_minimum_required (VERSION 3.7 ) 
Project (Clion_mysql) 

the SET (CMAKE_CXX_STANDARD 11 ) 

the SET (SOURCE_FILES main.cpp) 
# above basic unimportant 


# declaration header file path to 
the SET (INC_DIR C: \\ Program \ Files \\ \\ MySQL MySQL \ Server \ 8.0 \\ the include) 

# link library path statement 
the SET (LINK_DIR C: \\ Program \ files \\ \\ MySQL MySQL \ Server \ 8.0 \\ lib) 

# introduction header file 
include_directories ($ INC_DIR {}) 

# import library file 
link_directories ($ {} LINK_DIR) 
link_libraries (for libmysql) 

add_executable (Clion_mysql SOURCE_FILES $ {}) 

target_link_libraries (Clion_mysql for libmysql)

Remember, if you include and lib path to your mysql library with a space, then the space in front + '\'

Not finished, in your clion debug directory (I called cmake-build-debug)

Add libmysql.dll and libmysql.lib, these two files are in your mysql library, own room

Then you can use the mysql.h

Thank me ~~ Kiddos

Guess you like

Origin www.cnblogs.com/--HPY-7m/p/12669834.html