Hi, I am following a tutorial for MySQL C API Programming;
MySQL C API programming tutorial
My main.c looks like this:
Code:#include<stdio.h> #include<mysql.h> int main(){ printf("MySQL client version: %s\n", mysql_get_client_info()); exit(0); }
I was able to build and run the program on the terminal
gcc main.c -o main `mysql_config --cflags --libs`
However, I want to achieve the same thing in CLion IDE.
My CMakeLists.txt file has the following content.
Code:cmake_minimum_required(VERSION 3.6) project(dbJob) set(CMAKE_C_STANDARD 99) set(SOURCE_FILES main.c) add_executable(dbJob ${SOURCE_FILES}) include_directories(/usr/include/mysql/) link_directories(/usr/include/mysql/)
Upon building, the CLion outputs the following:
undefined reference to `mysql_get_client_info'
Can I get some help.
Thanks.