List:General Discussion« Previous MessageNext Message »
From:Ray Yous Date:April 5 1999 6:07pm
Subject:[MySQL] linker prolblem
View as plain text  
Submitter-Id:
Originator: none
Organization: home
MySQL support: none
Synopsis: serious
Severity: serious
Priority: medium
Category: mysql C API's
Class: linker troublbe to lib files
Release: mysql-3.21.33b


Environment:

System: FreeBSD 4.X
Architecture: Intel hardware I guess which the ISP may be using
Some paths:
             header files   /usr/local/include/mysql
             Lib files      /usr/local/lib/mysql
gcc version 2.7.2.3

Description:

   I have been have this problem for a while now and I have asked this 
question before but I can't get past this problem.  I have looked though 
the archives but no answer.  The onl;y information related to my problem 
in the mySQL manual is about adding the math lib to help linking and but 
no help.
   I am trying to get just connection help to mysql through a C program 
using C API's but I get the same error in the linking process.  

Error:

$ gcc -I/usr/local/include/mysql program.c -L/usr/local/lib/mysql 
-lmysqlclient -o program
/var/tmp/ccXW16381.o: Undefined symbol `_mysql_init' referenced from 
text segment
$

Code:

#include<stdio.h>
#include"mysql.h"

int main()
 {
  MYSQL *mysql;

  mysql_init();

  return(0);
 }

   Why can't it find the function in its own lib files "mysql_init"?  
Could the lib files be corrupted or the headers.  Or am I just to new to 
this and can't figure it out.  I am sorry to bother you guys and that 
you get this question a lot, but I have searched a lot and can't find 
resouce to help me.  

P.S. Thank you earlier Thimble Smith, but I am still in the problem.

Thank you,
Roger


When linking with the C API, the following errors may occur on some 
systems: 

gcc -g -o client test.o -L/usr/local/lib/mysql -lmysqlclient -lsocket 
-lnsl

Undefined        first referenced
 symbol          in file
floor            /usr/local/lib/mysql/libmysqlclient.a(password.o)
ld: fatal: Symbol referencing errors. No output written to client

If this happens on your system, you must include the math library by 
adding -lm to the end of the
compile/link line. 
Get Your Private, Free Email at http://www.hotmail.com
Thread
[MySQL] linker prolblemRay Yous5 Apr
  • Re: [MySQL] linker prolblemCharles Kirby5 Apr
  • [MySQL] linker prolblemMichael Widenius6 Apr