May 2, 2013 at 12:23pm UTC
Hello friends
ok - this is c - not c++. But the solution must be about the same.
With a test following compiles without problems:
gcc-o test test.c `pkg-config - libs - cflags gtk + -2.0`
I already have a makefile for my realy program. Now I also want the program to use gtk-2.0.
No matter what I've tried I get the error message gtk / gtk.h "No such file or directory" on compilation
How do I embed gtk into my makefile?
Christian
May 2, 2013 at 1:21pm UTC
I tryed to make following
GTKCFLAGS = `pkg-config - libs - cflags gtk + -2.0`
I all ready had following
CFLAGS = -c -O2 -g0 -DBUILDING_LINUX_DLL -D_P_ALIGNED_=packed -fsigned-char -Wall -Wsign-compare $(INCLUDE)
Where $(INCLUDE) is
INCLUDE = -I"include" -I"$(SPTH)" -I"$(SPTH)/include" -I"$(SPTH)/common" -I"$(SPTH)/merch_ecr"
and $(LIBRARY)
LIBRARY = "FlexDriver.so" -L"lib" -L"$(LPTH)" --no-export-all-symbols --add-stdcall-alias
My existing $(CC) is
$(OUTF): $(OBJS) depend
$(CC) -g -Wl,-Map,$(OUTF).map -g -o $@ $(OBJS) $(LIBRARY)
And
%.d: %.c
$(CC) -M $(CFLAGS) $< | sed 's/$</ Makefile $</' > $@
Where and how shall i place $(GTKCFLAGS) and am i missing something in LIBRARY and INCLUDE?
May 2, 2013 at 1:23pm UTC
As you may understand i am not wery trained in makefiles
May 2, 2013 at 3:19pm UTC
¿why the weird spaces and missing dash?
pkg-config - libs - cflags gtk + -2.0
pkg-config --libs --cflags gtk+-2.0
CFLAGS+=$(GTKCFLAGS)
If you prefer, separate the flags according to the instance.
So in compilation use `pkg-config --cflags' and in linking `pkg-config --libs'
May 3, 2013 at 7:57am UTC
Sorry - I do use -- not - and no weird space
The reason why i separate is that an other programmer has made the makefile some time ago. I am just going to add on.
Do you mean that i kan just change CFLAGS from
CFLAGS = -c -O2 -g0 -DBUILDING_LINUX_DLL -D_P_ALIGNED_=packed -fsigned-char -Wall -Wsign-compare $(INCLUDE)
to
CFLAGS = -c -O2 -g0 -DBUILDING_LINUX_DLL -D_P_ALIGNED_=packed -fsigned-char -Wall -Wsign-compare $(INCLUDE) pkg-config --libs --cflags gtk+-2.0
?
I have some ide that the problem is in the 2 lines
INCLUDE = -I"include" -I"$(SPTH)" -I"$(SPTH)/include" -I"$(SPTH)/common" -I"$(SPTH)/merch_ecr"
and
LIBRARY = "FlexDriver.so" -L"lib" -L"$(LPTH)" --no-export-all-symbols --add-stdcall-alias
but where I dont know.
As i wrote i am knew in makefiles.
May 3, 2013 at 12:17pm UTC
you are missing the ` surrounding pkg-config (you need the output of the command)j
otherwise, yes that's the idea.
> I have some ide that the problem is in the 2 lines (...)
I don't understand what you are trying to say. ¿what is the problem?
Also, try to provide a testcase