Well, you could be lazy and let ProjectCenter write the makefiles for you. A closer look at what it produces reveals the following two items:
# Additional flags to pass to the linker ADDITIONAL_LDFLAGS += -lmysqlclient # Additional library directories the linker should search ADDITIONAL_LIB_DIRS += -L/usr/lib Best regards, Marko +-------------------------------------------------------------+ | Marko Riedel, EDV Neue Arbeit gGmbH, [EMAIL PROTECTED] | | http://www.geocities.com/markoriedelde/index.html | +-------------------------------------------------------------+ --- Jaroslav Joska <[EMAIL PROTECTED]> schrieb am Mo, 21.7.2008: > Von: Jaroslav Joska <[EMAIL PROTECTED]> > Betreff: Howto write GNUmakefile.preamble with using C API > An: "GNUstep" <[email protected]> > Datum: Montag, 21. Juli 2008, 21:10 > Hi all! > > When I waited for reply to my question about installing > SQLClient, > I tried C program API to connect with MySQL. Tjis is C file > test.c: > > *#include* <mysql.h> > *#include* <stdio.h> > > *main*() { > MYSQL *conn; > MYSQL_RES *res; > MYSQL_ROW row; > > char *server = "localhost"; > char *user = "root"; > char *password = "PASSWORD"; //* set me first > *// > char *database = "mysql"; > > conn = *mysql_init*(NULL); > > //* Connect to database *// > *if* (!*mysql_real_connect*(conn, server, > user, password, database, 0, NULL, 0)) { > *fprintf*(stderr, "%s\n", > *mysql_error*(conn)); > *exit*(1); > } > > //* send SQL query *// > *if* (*mysql_query*(conn, "show tables")) { > *fprintf*(stderr, "%s\n", > *mysql_error*(conn)); > *exit*(1); > } > > res = *mysql_use_result*(conn); > > //* output table name *// > *printf*("MySQL Tables in mysql > database:\n"); > *while* ((row = *mysql_fetch_row*(res)) != NULL) > *printf*("%s \n", row[0]); > > //* close connection *// > *mysql_free_result*(res); > *mysql_close*(conn); > } > > I successfully complied with this command: > # |*gcc -o test $(mysql_config --cflags) test.c > *||*$(mysql_config --libs)*| > #./test > and it's fully working. > > > And this is my question. Can I compile this file (first > rename to > test.m) with GNUstep make? > I changed GNUstep.preamble many times. I compiled test.m > file without > error massage, but > for everytime I got "Segmentation fault :11" > without core file. > > Does anybody knows which variables in my > GNUmakefile.preamble have I to > change? > ADDITIONAL_CPPFLAGS += > ADDITIONAL_OBJCFLAGS += > ADDITIONAL_TOOL_LIBS += -L/usr/local/lib/mysql > -lmysqlclient -lz -lcrypt -lm > ADDITIONAL_CFLAGS += -I/usr/local/include/mysql > -fno-strict-aliasing -pipe > ADDITIONAL_INCLUDE_DIRS += -I/usr/local/include/mysql > ADDITIONAL_LDFLAGS += > ADDITIONAL_LIB_DIRS += -L/usr/local/lib/mysql > ADDITIONAL_INSTALL_DIRS += > > This is my MySQL configuration. > # mysql_config > Usage: /usr/local/bin/mysql_config [OPTIONS] > Options: > --cflags [-I/usr/local/include/mysql > -fno-strict-aliasing -pipe] > --include [-I/usr/local/include/mysql] > --libs [-L/usr/local/lib/mysql > -lmysqlclient -lz > -lcrypt -lm] > --libs_r [-L/usr/local/lib/mysql > -lmysqlclient_r -lz > -pthread -lcrypt -lm -pthread] > --socket [/tmp/mysql.sock] > --port [0] > --version [5.1.23-rc] > --libmysqld-libs [-L/usr/local/lib/mysql -lmysqld > -lz -pthread > -lcrypt -lm -pthread -lwrap] > > > > _______________________________________________ > Discuss-gnustep mailing list > [email protected] > http://lists.gnu.org/mailman/listinfo/discuss-gnustep __________________________________________________________ Gesendet von Yahoo! Mail. Dem pfiffigeren Posteingang. http://de.overview.mail.yahoo.com _______________________________________________ Discuss-gnustep mailing list [email protected] http://lists.gnu.org/mailman/listinfo/discuss-gnustep
