GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Fri Jul 25, 2014 11:18 am

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: GTK Makefile error
PostPosted: Thu Apr 12, 2012 3:46 am 
Offline

Joined: Wed Apr 11, 2012 2:59 pm
Posts: 4
I was hoping someone could figure out my error in my makefile.

I keep getting this error:
../lib/gtk.h:4:22: fatal error: gtk/gtk.h: No such file or directory
compilation terminated.

I think the error might be in my makefile, here is my makefile. If anyone can spot why this happening please let me know. I am using the command make test when i get this error.

Code:
#
# makefile for gtk
#

ARG = `pkg-config --cflags --libs gtk+-2.0`
RM = rm -f
SRC = no.c night.c exit_event.c destroy.c delete_event_exit.c delete_event.c day.c main.c
OBJ = $(SRC:.c=.o)
TESTNAME = test
TESTSRC = main.c
TESTOBJ = $(TESTSRC:.c=.o)
#

clean:
   -$(RM) *.o
   -$(RM) *~
   -$(RM) \#*
   -$(RM) *.core

fclean: clean
   -$(RM) $(TESTNAME)

re: fclean

test: $(TESTOBJ)
   cc $(TESTSRC) -o $(TESTNAME) $(ARG)


Top
 Profile  
 
 Post subject: Re: GTK Makefile error
PostPosted: Thu Apr 12, 2012 6:02 am 
Offline
Familiar Face

Joined: Thu Dec 15, 2011 6:23 pm
Posts: 36
Location: Hrvatska
try this ,
define those two:
Quote:
CFLAGS = -g $(shell pkg-config --cflags gtk+-2.0)
LIBS = $(shell pkg-config --libs gtk+-2.0)

and later use it :
Quote:
cc $(TESTSRC) $(CFLAGS) -o $(TESTNAME) $(LIBS)

never use Makefile before. I am addicted to Eclipse IDE.
thanks for pushing me to learn this.
cheers !

btw. why you use GTK+ 2.0 if you start to learn do it with NEW one: GTK+ 3.0 ?!


Top
 Profile  
 
 Post subject: Re: GTK Makefile error
PostPosted: Thu Apr 12, 2012 6:13 am 
Offline

Joined: Wed Apr 11, 2012 2:59 pm
Posts: 4
That did not work :/.

I am using Gtk 2.0 because that is what my teacher wants us to use lol.


Top
 Profile  
 
 Post subject: Re: GTK Makefile error
PostPosted: Thu Apr 12, 2012 10:43 pm 
Offline
Never Seen the Sunlight

Joined: Thu Mar 24, 2011 2:10 pm
Posts: 328
Location: Sydney, Australia
As you're learning makefiles, you may want to learn the autotools, which will do a lot of things for you and standardise formats so its easier to see what goes wrong (error messages are also more meaningful). I've long since forgotten what a makefile is meant to look like; only dealing with Makefile.am's.
Only thing I can think of is to ask if you have the -dev packages installed that will include the header files (looks like that is what the error messge's about). The other option is that the pkg-config line is not communicating right with the include in your source.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group