Getting error when compiling
I am trying to use the mysql.h file from libmysqlclient-dev to connect to mysql following the tutorial https://zetcode.com/db/mysqlc/ but I get the following error:
cannot find -lmysqlclient: No such file or directory.
I can run it fine on my own terminal with the following command: c99 mysql.c -o mysql -lmysqlclient.
My main.c code:
#include <stdio.h>
#include "mysql.h"
int main(int argc, char **argv)
{
printf("MySQL client version: %s\n", mysql_get_client_info());
exit(0);
}
My CMakeLists:
cmake_minimum_required(VERSION 3.30)
project(untitled C)
set(CMAKE_C_STANDARD 99)
set(SOURCE_FILES main.c)
add_executable(untitled ${SOURCE_FILES})
target_link_libraries(untitled mysqlclient)
Please sign in to leave a comment.