I'm trying to get started with using mySQL C API for a project that I'm hoping to complete.
I've downloaded the mySQL Community Server version and the mySQL Connector/C from the official site.
Q1: Do I also need to download Connector/ODBC? What is the difference?
So, this is a basic program that I learnt and am trying to compile and link:
#include<stdio.h>
#include<mysql.h>
int main(int argc, char **argv)
{
printf("MySQL client version: %s\n", mysql_get_client_info());
exit(0);
}
I'm extremely confused as to what commands for compilation and linking I should use. When I do the following, this happens:
gcc mySQL.c -I/usr/local/mysql/include
Undefined symbols for architecture x86_64:
"_mysql_get_client_info", referenced from:
_main in mySQL-a3f748.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Can someone just help me out with this? I've struggled a lot and it all seems extremely confusing.
My question is about compiling and linking mySQL C API libraries and not the error.