Hi again,
Let me try this again and give everyone more information on my problem. As I
have tried the other suggestions but still the same problem. I think I am not
able to link the correct files with my simple code. All I want to do now is
at lest connect to MySQL database with my C program. I was told to use the
mysqlbug program but I don't know how, but I did find it though. So here is
as much information I can think of to give.
Server Software: FreeBSD 2.2.7
MySQL version: 3.21.33b
Compiler: gcc version
Code I wrote:
#include<stdio.h>
#include<stdlib.h>
#include"/usr/ports/databases/mysql321/work/mysql-3.21.33b/include/mysql.h"
// if I put in #include"mysql.h" the compile can't link the files even
when I supply //the path to it with the -l flag.
MYSQL mysql;
void exiterr(int exitcode)
{
fprintf( stderr, "%s\n", mysql_error(&mysql) );
exit( exitcode );
}
int main()
{
mysql_init();
if ( ! (mysql_connect(&mysql,"NULL","NULL","NULL")))
exiterr(1);
if (mysql_select_db(&mysql,"test"))
exiterr(2);
}
Error Messages:
Try #1:
bash-2.02$ gcc test.c
/var/tmp/cctu24781.o: Undefined symbol `_mysql_init' referenced from text
segmen
t
/var/tmp/cctu24781.o: Undefined symbol `_mysql_connect' referenced from text
seg
ment
Try #2:
bash-2.02$ gcc test.c -lmysqlclient
ld: -lmysqlclient: no match
Try #3:
bash-2.02$ gcc
-l/usr/ports/databases/mysql321/work/mysql-3.21.33b/include\test.
c\ -L/usr/ports/databases/mysql321/work/mysql-3.21.33b/include\ -lmysqlclient
-l
m\ -o test
gcc: test: No such file or directory
Change code:
old line:
#include"/usr/ports/databases/mysql321/work/mysql-3.21.33b/include/mysql.h"
new line:
#include"mysql.h"
Error Messages:
Try #1:
bash-2.02$ gcc test.c -lmysqlclient
test.c:5: mysql.h: No such file or directory
Try#2:
bash-2.02$ gcc test.c
-l/usr/ports/databases/mysql321/work/mysql-3.21.33b/includ
e/
test.c:5: mysql.h: No such file or directory
So how do I do this? How do I use mysqlclient lib? What do I do. I am very
confused. How do I create a proper debugger report for you guys also.
Thank you very much for the help,
--Ray