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