[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Howto write GNUmakefile.preamble with using C API
From: |
Jaroslav Joska |
Subject: |
RE: Howto write GNUmakefile.preamble with using C API |
Date: |
Tue, 22 Jul 2008 11:30:57 +0200 (CEST) |
> First of all, you can compile the C file using gnustep-make. Use the
> following
> GNUmakefile:
> include $(GNUSTEP_MAKEFILES)/common.make
> CTOOL_NAME = test
> test_C_FILES = test.c
> ADDITIONAL_CFLAGS += $(shell mysql_config --cflags)
> ADDITIONAL_TOOL_LIBS += $(shell mysql_config --libs)
> include $(GNUSTEP_MAKEFILES)/ctool.make
!!!!!!!! IT WORK'S" !!!!!!!!
> If you want to migrate it to Objective-C, then rename your test.c file to
> test.m, and slightly modify your GNUmakefile:
> include $(GNUSTEP_MAKEFILES)/common.make
> TOOL_NAME = test
> test_OBJC_FILES = test.m
> ADDITIONAL_OBJCFLAGS += $(shell mysql_config --cflags)
> ADDITIONAL_TOOL_LIBS += $(shell mysql_config --libs)
> include $(GNUSTEP_MAKEFILES)/tool.make
>
It doesn't work, because compiler doesn't know variables
ADDITIONAL_OBJCFLAGS += $(shell mysql_config --cflags)
Here is output of command 'gmake massages=yes'. I'm using
gmake (version 3.81), that's native in FreeBSD.
This is gnustep-make 2.0.5. Type 'make print-gnustep-make-help' for help.
Making all for tool test...
cd .; \
/usr/GNUstep/System/Library/Makefiles/mkinstalldirs ./obj
gcc test.c -c \
-MMD -MP -DGNUSTEP -DGNUSTEP_BASE_LIBRARY=1 -DGNU_GUI_LIBRARY=1
-DGNU_RUNTIME=1 -DGNUSTEP_BASE_LIBRARY=1 -D_REENTRANT -pthread -fPIC -g -Wall
-DDEBUG -fno-omit-frame-pointer -DGSWARN -DGSDIAGNOSE -Wno-import -g -I.
-I/usr/local/include -I/root/GNUstep/Library/Headers
-I/usr/GNUstep/Local/Library/Headers -I/usr/GNUstep/System/Library/Headers \
-o obj/test.o
test.c:1:19: warning: mysql.h: No such file or directory
test.c:3: warning: return type defaults to `int'
test.c: In function `main':
test.c:4: error: `MYSQL' undeclared (first use in this function)
test.c:4: error: (Each undeclared identifier is reported only once
test.c:4: error: for each function it appears in.)
test.c:4: error: `conn' undeclared (first use in this function)
test.c:5: error: `MYSQL_RES' undeclared (first use in this function)
test.c:5: error: `res' undeclared (first use in this function)
test.c:6: error: syntax error before "row"
test.c:13: warning: implicit declaration of function `mysql_init'
test.c:16: warning: implicit declaration of function `mysql_real_connect'
test.c:18: warning: implicit declaration of function `mysql_error'
test.c:18: warning: format argument is not a pointer (arg 3)
test.c:19: warning: implicit declaration of function `exit'
test.c:23: warning: implicit declaration of function `mysql_query'
test.c:24: warning: format argument is not a pointer (arg 3)
test.c:28: warning: implicit declaration of function `mysql_use_result'
test.c:32: error: `row' undeclared (first use in this function)
test.c:32: warning: implicit declaration of function `mysql_fetch_row'
test.c:36: warning: implicit declaration of function `mysql_free_result'
test.c:37: warning: implicit declaration of function `mysql_close'
gmake[1]: *** [obj/test.o] Error 1
gmake: *** [test.all.tool.variables] Error 2
When I changed line
ADDITIONAL_OBJCFLAGS += $(shell mysql_config --cflags)
to
ADDITIONAL_CFLAGS += $(shell mysql_config --cflags)
so compiled it successfully, but still Segmentation fault: 11
Any ideas?