List:General Discussion« Previous MessageNext Message »
From:Faisal Nasim Date:November 19 1999 1:41pm
Subject:undefined reference?
View as plain text  
What is wrong? I got this error when I installed MYSQL from
the downloadable RPMS... but read Michael's response that
rebuilding the source rpm should fix this, so did that...
didn't work! :(

$ gcc -I /usr/include/mysql test.c

#include <stdio.h>
#include <mysql.h>
#include <sys/time.h>

main ()
{
 MYSQL_RES *res;
 MYSQL_ROW row;
 MYSQL *connection , mysql;
 int state;
 mysql_init ( &mysql );
 connection = mysql_connect ( &mysql , "localhost" , NULL , NULL );
}

/tmp/ccmkyfrq.o: In function `main':
/tmp/ccmkyfrq.o(.text+0x11): undefined reference to `mysql_init'
/tmp/ccmkyfrq.o(.text+0x29): undefined reference to `mysql_connect'
collect2: ld returned 1 exit status




Server version  3.23.6-alpha-log
Protocol version 10
Connection  Localhost via UNIX socket
UNIX socket  /var/lib/mysql/mysql.sock

>Environment:
 <machine, os, target, libraries (multiple lines)>
System: Linux localhost.localdomain 2.2.5-15 #1 Mon Apr 19 23:00:46 EDT 1999
i686 unknown
Architecture: i686

Some paths:  /usr/bin/perl /usr/bin/make /usr/bin/gmake /usr/bin/gcc
/usr/bin/cc
GCC: Reading specs from
/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/specs
gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)
Compilation info: CC='egcs'  CFLAGS=' -O6 -fomit-frame-pointer'  CXX='egcs'
CXXFLAGS=' -O6 -fomit-frame-pointer            -felide-constructors -fno-exc
eptions -fno-rtti'  LDFLAGS=''
LIBC:
lrwxrwxrwx   1 root     root           13 Jun 19 19:12 /lib/libc.so.6 ->
libc-2.1.1.so
-rwxr-xr-x   1 root     root      4016683 Apr 17  1999 /lib/libc-2.1.1.so
-rw-r--r--   1 root     root     19533408 Apr 17  1999 /usr/lib/libc.a
-rw-r--r--   1 root     root          178 Apr 17  1999 /usr/lib/libc.so
-rwxr-xr-x   1 root     root      4016683 Sep  8 18:38 /usr/lib/libc.so.6
-rwxr-xr-x   1 root     root      4016683 Sep  8 18:38
/usr/lib/libc-2.1.1.so
Configure command:
./configure  --disable-shared --with-mysqld-ldflags=-all-static --with-clien
t-ldflags=-all-static --enable-assembler --with-mysqld-user=mysql --with-uni
x-socket-path=/var/lib/mysql/mysql.sock --prefix=/ --exec-prefix=/usr --libe
xecdir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --localstatedir=/var
/lib/mysql --infodir=/usr/info --includedir=/usr/include --mandir=/usr/man
'--with-comment=Official MySQL RPM'
Perl: This is perl, version 5.005_62 built for i686-linux

--
Faisal Nasim (the Whiz Kid)
Web: http://wss.hypermart.net/
FAX: (815) 846-2877 AOL IM: Whiz Swift

Thread
undefined reference?Faisal Nasim19 Nov
  • Re: undefined reference?André Bjärby19 Nov
  • Re: undefined reference?sinisa19 Nov