Hello,
I have the following problem with mysql linking:
1) 'mysql_config --libs' return (correctly) the following:
-L/usr/local/mysql/lib -lmysqlclient -lz -lcrypt -lnsl -lm -lc -lnss_files
-lnss_dns -lresolv -lc -lnss_files -lnss_dns -lresolv
2) compile + link command is based on mysql_config:
gcc -o t01 -I /usr/local/mysql/include/ -L/usr/local/mysql/lib -lmysqlclient
-lz -lcrypt -lnsl -lm -lc -lnss_files -lnss_dns -lresolv -lc -lnss_files
-lnss_dns -lresolv t01.c -o t01
my versions are:
MySQL: 4.0.17
gcc: 3.3.3
platform: Linux
3) and my (very) simple test C file (referenced t01.c in previous gcc
command):
#include <stdio.h>
#include <mysql.h>
int main( int argc, char *argv[] )
{
MYSQL conn;
mysql_init( &conn );
//...
}
but I received the (arrghhh....) following error:
/tmp/ccbPFqEt.o(.tex t+0x1e): In function `main':
: undefined reference to `mysql_init'
collect2: ld returned 1 exit status
Thanks for any help.
I have the following problem with mysql linking:
1) 'mysql_config --libs' return (correctly) the following:
-L/usr/local/mysql/lib -lmysqlclient -lz -lcrypt -lnsl -lm -lc -lnss_files
-lnss_dns -lresolv -lc -lnss_files -lnss_dns -lresolv
2) compile + link command is based on mysql_config:
gcc -o t01 -I /usr/local/mysql/include/ -L/usr/local/mysql/lib -lmysqlclient
-lz -lcrypt -lnsl -lm -lc -lnss_files -lnss_dns -lresolv -lc -lnss_files
-lnss_dns -lresolv t01.c -o t01
my versions are:
MySQL: 4.0.17
gcc: 3.3.3
platform: Linux
3) and my (very) simple test C file (referenced t01.c in previous gcc
command):
#include <stdio.h>
#include <mysql.h>
int main( int argc, char *argv[] )
{
MYSQL conn;
mysql_init( &conn );
//...
}
but I received the (arrghhh....) following error:
/tmp/ccbPFqEt.o(.tex t+0x1e): In function `main':
: undefined reference to `mysql_init'
collect2: ld returned 1 exit status
Thanks for any help.
Comment