List:General Discussion« Previous MessageNext Message »
From:RaymanJ Date:March 19 1999 8:54pm
Subject:[MySQL] link error
View as plain text  
Hello,
	I am testing out how to connect to MySQL with a C program.  This is the first
time for me to do this. 
	Problem:
		When ever I compile my program it gives me an error message as below.

/var/tmp/ccyP17051.o: Undefined symbol `_mysql_connect' referenced from text
seg
ment

	I have tried to locate this file but to no avail.  Can anyone help me with
this.  Why is it happening and how to fix it.
My code below:

#include<stdio.h>
#include<stdlib.h>
#include"/usr/ports/databases/mysql321/work/mysql-3.21.33b/include/mysql.h"

MYSQL mysql;

void exiterr(int exitcode)
{
        fprintf( stderr, "%s\n", mysql_error(&mysql) );
        exit( exitcode );
}

int main()
{
        mysql_connect(&mysql, NULL, NULL, NULL);
                exiterr(1);

        if (mysql_select_db(&mysql,"test"))
                exiterr(2);

}

Thanks,
Ray
Thread
[MySQL] link errorRaymanJ19 Mar
  • Re: [MySQL] link errorPaul DuBois19 Mar
  • Re: [MySQL] link errorThimble Smith19 Mar
  • Re: [MySQL] link errorWade Maxfield19 Mar