Not sure exactly what forum this post belongs to but I'm having trouble trying to link library files to compile simple mysql client below is the code I have just to test the mySQL C API funcions.:
Code:
#include <stdio.h>
#include <winsock.h>
#include <mysql.h>
#include <stdlib.h>
MYSQL connection;
int main (void)
{
printf ("This is an SQL test.\n\n");
printf ("Attempting to access mySQL API funcs...\n");
printf ("Calling mySQL init:\n");
if( !mysql_init(&connection))
fprintf (stderr, "Initialisation failed. Error: %s\n", mysql_error(&connection));
printf ("Attempting to login....\n");
if ( !mysql_real_connect(&connection, "localhost", "lan", "","test", 0,NULL,0) )
fprintf (stderr, "Failed to connect to database. Error: %s. \nTry again later.\n", mysql_error(&connection));
getchar();
return 0;
}
I get errors along the lines of:
[Linker error] undefined reference to `mysql_real_connect@32' at least with anything to do with the mySQL API. I have tried linking in the library file from the mySQL lib folder but the mysqlClient throws so many errors at me that I'm stumped.
Any help would be greatly appreciated.