You are not logged in.

#1 2011-07-16 20:09:13

pizet
Member
From: Slovak Republic
Registered: 2011-06-18
Posts: 18

[SOLVED] Troubles with compiling Gtk+

Hello,

this is embarassing, but I get an error when I try to compile this code:

#include <gtk/gtk.h>

int main(int argc, char **argv)
{
  GtkWidget *window;

  gtk_init(&argc, &argv);

  window = gtk_window_new(GTK_WINDOW_TOPLEVEL);

  g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit), NULL);

  gtk_widget_show(window);

  return 0;
}

with command:

$ gcc hello_gtk.c -o hello_gtk 'pkg-config --cflags --libs gtk+-3.0'

and I get and error:

gcc: error: pkg-config --cflags --libs gtk-3.0: No such file or directory

My path to file "gtk.h" (quotes for clarity) is:

/usr/include/gtk+-3.0/gtk/gtk.h

Do you have an idea, what could the problem be?

Thanks,

-pizet

Last edited by pizet (2011-07-17 07:31:25)


Do you follow my way? Or just see a black stain swimming in the Milky Way...

Offline

#2 2011-07-16 21:41:46

SahibBommelig
Member
From: Germany
Registered: 2010-05-28
Posts: 80

Re: [SOLVED] Troubles with compiling Gtk+

You want either

gcc hello_gtk.c -o hello_gtk `pkg-config --cflags --libs gtk+-3.0`

or

gcc hello_gtk.c -o hello_gtk $(pkg-config --cflags --libs gtk+-3.0)

With simple quotes gcc thinks this is a file..

Edit: Also your program doesn't call the gtk_main().

Last edited by SahibBommelig (2011-07-16 21:43:53)

Offline

#3 2011-07-16 21:43:52

pizet
Member
From: Slovak Republic
Registered: 2011-06-18
Posts: 18

Re: [SOLVED] Troubles with compiling Gtk+

Oh my god, yes, I'm fool.


Do you follow my way? Or just see a black stain swimming in the Milky Way...

Offline

Board footer

Powered by FluxBB