How do i embed gtk into my makefile

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
Your makefile should issue the same command.
1
2
test: test.c
	gcc -o test test.c `pkg-config --libs --cflags gtk+-2.0`


You may use the `CPPFLAGS' variable
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?
As you may understand i am not wery trained in makefiles
¿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'
xfgdsf
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.
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
d
Topic archived. No new replies allowed.