[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: gtk+ and eclipse problems



I have not explored the newest version of eclispe, which reports that it
supports the autoconfig framework inside it "Managed Make" features; so
there may be an easier way than this one.

I always add a 'Makefile' in my source directory that includes the
needed commands to build a gtk+ project.  eclispe then has a properties
tab that lets you choose the default build command "i.e. make'.  Here is
an example Makefile that should work for your sample.

James,

BEGIN-MAKEFILE  (indents are required to be  TABS)
## Build the example programs

FLAGS = -Wall -O2

CFLAGS  = `pkg-config --cflags --libs gtk+-2.0 glib-2.0 gthread-2.0` -lm
COFLAGS  = `pkg-config --cflags gtk+-2.0 >= 2.4.0 glib-2.0 >= 2.4.0
gthread-2.0` -lm

CC= gcc $(FLAGS) $(CFLAGS)
CO= gcc $(FLAGS) $(COFLAGS)

LINK_TARGET = your_program_name_here

all: $(LINK_TARGET) 
	@echo All Done
	
%. : %.c
	@echo "Compiling A" $<
	$(CC) -o $@ -c $<
	@echo "built " $<

%.o : %.c
	@echo "Compiling B" $<
	$(CO) -o $@ -c $<
	@echo "built " $<

clean:
	rm -fv *.o *~ $(LINK_TARGET)

END-MAKEFILE

On Tue, 2008-03-25 at 15:24 +0300, Roman Makurin wrote:

> Hi All!
> 
> It`s my first post to this list, so be patient :) I`ve got a problem
> with compiling gtk+ project in eclipse. Here is the simplest project
> from gtk tutorial:
> 
> #include <gtk/gtk.h>
> 
> int main( int   argc,
>           char *argv[] )
> {
>     GtkWidget *window;
>     
>     gtk_init (&argc, &argv);
>     
>     window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
>     gtk_widget_show  (window);
>     
>     gtk_main ();
>     
>     return 0;
> }
> 
> As you know, to get this working I need to pass additional options
> to gcc: `pkg-config --cflags --libs gtk+-2.0`. I think my problem
> is eclipse specific. I look through project settings but can`t find
> where to place above command. Is there any howto describing gtk+
> development with eclipse ? 
> 
> Thanks
> 
> PS: Sorry for my english
> 
> _______________________________________________
> gtk-app-devel-list mailing list
> gtk-app-devel-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]