January 30th, 2000, 10:43 AM
Hopefully this is just a really silly question:
I can't figure out where the MySQL library is at!
I'm using Linux RH 5.2 & MySQL installed by using the source RPM and doing rpm --rebuild [mysql.rpm]. I've done some quick tests and verified mysqld is working ok.
I found the include files:
The test program I wrote:
MYSQL *connection, mysql;
} // end void main()
I compile using g++:
/tmp/cca057881.o: In function `main':
/tmp/cca057881.o(.text+0x11): undefined reference to `mysql_init'
collect2: ld returned 1 exit status
If I compile under gcc I get the same error. I beleive this is because g++/gcc don't know where the libraries are at (and neither do I!)
January 31st, 2000, 01:31 PM
Try changing the third include directive back to #include <mysql.h> and use the -I, -L and -lmysqlclient switches when compiling and linking
gcc -c -I/var/tmp/mysql/usr/include/mysql program.c
gcc -o program program.o -L/var/tmp/mysql/usr/lib/mysql -lmysqlclient
..or wherever the header files and client library are located