Cannot Resolve External Symtab Entries to mysqlclient Library Within C Program
I am attempting to interface between a simple C program and MySQL client library, but without luck. I searched the MySQLforum archives to see if there was info specific to this problem. While there were other folks who had problems connecting C/C++ to MySQL, none of the issue were similar to this, that is linking to resolve external name table references. Here is the actual program: *** myprog.cc *** #include /usr/include/mysql/mysql.h int main(void) { MYSQL * myptr; mysql_init(myptr); return 0; } To compile it, I use: $ gcc -c myprog.cc To link/load: $ ld myprog.o -o myprog ld: warning: cannot find entry symbol _start; defaulting to 08048074 myprog.o: In function `main': myprog.o(.text+0xd): undefined reference to `mysql_init I tried the following (with this result): $ ld -lmysqlclient -o myprog myprog.o ld: warning: cannot find entry symbol _start; defaulting to 08048208 /usr/lib/libmysqlclient.so: undefined reference to [EMAIL PROTECTED]' Or, if I compile and link/load in one step, I get this: $ gcc -o myprog myprog.cc /tmp/ccJ8uuvK.o: In function `main': /tmp/ccJ8uuvK.o(.text+0xd): undefined reference to `mysql_init' collect2: ld returned 1 exit status And ls -l /usr/lib/libmysqlclient* reveals: rwxrwxrwx1 root root 24 Mar 13 19:34 /usr/lib/libmysqlclient.so - libmysqlclient.so.12.0.0 lrwxrwxrwx1 root root 24 Mar 13 19:34 /usr/lib/libmysqlclient.so.10 - libmysqlclient.so.10.0.0 -rwxr-xr-x1 root root 224606 Feb 13 04:25 /usr/lib/libmysqlclient.so.10.0.0 lrwxrwxrwx1 root root 24 Mar 13 19:34 /usr/lib/libmysqlclient.so.12 - libmysqlclient.so.12.0.0 -rwxr-xr-x1 root root 249972 Feb 13 04:25 /usr/lib/libmysqlclient.so.12.0.0 lrwxrwxrwx1 root root 26 Mar 13 19:34 /usr/lib/libmysqlclient_r.so - libmysqlclient_r.so.12.0.0 lrwxrwxrwx1 root root 26 Mar 13 19:34 /usr/lib/libmysqlclient_r.so.10 - libmysqlclient_r.so.10.0.0 -rwxr-xr-x1 root root 230560 Feb 13 04:25 /usr/lib/libmysqlclient_r.so.10.0.0 lrwxrwxrwx1 root root 26 Mar 13 19:34 /usr/lib/libmysqlclient_r.so.12 - libmysqlclient_r.so.12.0.0 My setup is Red Hat Linux version 7.0. I used the latest mysql RPM (for Red Hat 7.0) from the mysql web-site Where can I go for help on this? If somebody has a suggestion, I'm all ears. FYI, using MySQL with PHP works like a charm from the command line and when called from a web-page. So, I know MySQL is there, ready to do my bidding. I looked through the latestMySQL manual concerning the C/C++ API; no help. thanks rick -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
mysqlclient library
Dear Friends i´ve just download mysql 4.0.14 where i can find an mysqlclient.lib for borland c++compilers, the one on windows download page is for version 3.23.xx Regards Luiz -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Please, help me to realize a dream....with mysqlclient library...
Hi, I'm a newer in database programming with C APIs, so the problem arose with the gcc compiler shouldn't surprise you. Now, here the problem. I've installed the Mysql server/client appliaction for win2000. After that, I enjoy the header files (mysql.h) to write a little program in C. The compiling was ok but once I've tried to build the program the gcc compiler gave me the following indication (and also the VisulaC++ compiler): gcc -c main.c Mysql_BuildIF.c -s -mwindows -mno-cygwin -fnative-struct -IC:\ mysql\include\ -IC:\ProgramFiles\MicrosoftVisualStudio\VC98\include gcc -o MySQL_BuildIF.exe main.o Mysql_BuildIF.o -LC:\mysql\lib\debug\mysql client.lib -LC:\ProgramFiles\MicrosoftVisualStudio\VC98\LIB -s -mwindows -mno-c ygwin -fnative-struct -IC:\mysql\include\ -IC:\ProgramFiles\MicrosoftVisualStudi o\VC98\include Mysql_BuildIF.o(.text+0x59):Mysql_BuildIF.c: undefined reference to `mysql_optio ns@12' Mysql_BuildIF.o(.text+0xfe):Mysql_BuildIF.c: undefined reference to `mysql_init@ 4' Mysql_BuildIF.o(.text+0x158):Mysql_BuildIF.c: undefined reference to `mysql_quer y@8' make: *** [all] Error 1 As the compiler didn't recognize the correct library to link to. Also, hereinafter you'll find attached the makefile I used to buil my Mysql_BuildIF.exe file. As you can see the linked library are in the path C.\mysql\lib\debug as the application had installed the library during its installation. INSTDIR=C:\mysql LIBMYSQL=C:\mysql\lib\debug WINDIR=C:\ProgramFiles\MicrosoftVisualStudio\VC98 ### # Compiler CC=gcc # Parameters given to the compiler CFLAGS=-s -mwindows -mno-cygwin -fnative-struct -I$(INSTDIR)\include\ -I$(WINDIR)\include #-L$(INSTDIR)\lib\ # Change the name of your output file here # OUTPUT=MySQL_BuildIF.exe # Modify your source files here # SRCS=main.c Mysql_BuildIF.c # Change the object files, according to the source files, here # Cconvention=__cdecl OBJS=main.o Mysql_BuildIF.o -L$(LIBMYSQL)\mysqlclient.lib -L$(WINDIR)\LIB -lmysqlclient -lz # Standard targets all: $(CC) -c $(SRCS) $(CFLAGS) $(CC) -o $(OUTPUT) $(OBJS) $(CFLAGS) Ccode: $(CC) -c $(SRCS) $(CFLAGS) test: all ./$(OUTPUT) clean: del *.o Please, what happened?? Fabio Varriale System Engineer ERI/TVA Phone: +39-06-72583940 E-mail: [EMAIL PROTECTED] - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail mysql-unsubscribe-##L=##[EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php