0

I'm trying to run a C program using Gtk3.0 and Cairo on a Codeblocks project.

But whenever I try to compile-run it, the codeblocks terminal emulator says:

GLib-GObject-WARNING **: /build/buildd/glib2.0-2.40.2/gobject/gsignal.c:2462: signal 'draw' is invalid for instance '0x211a870' of type 'GtkDrawingArea'

The line it refers to is this one:

g_signal_connect(G_OBJECT(actarea), "draw"   , G_CALLBACK(on_draw_event), NULL);

The Gtk window actually appears but NOT Cairos drawing area.

This is odd, because I compiled it manually (with emacs) and used

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

and did work! Same code in a codeblocks and that message appears on codeblocks terminal emulator. I need to use codeblocks but this keep me from running my program.

I already tried to include in "Compiler>other options" the commands

`pkg-config --cflags --libs cairo`
`pkg-config --libs cairo`

but didn't work.

What is happening and how to overcome this issue? Thanks!

tvaz
  • 97
  • 1
  • 10
  • What options you had configured in CB originally, before you tried the `cairo` stuff. – Mike Kinghan Jan 12 '16 at 20:22
  • I've always used emacs. This is my first time using codeblocks, so besides that change i've made to compiler>"other options" codeblocks is with its default configurations, I believe – tvaz Jan 12 '16 at 20:38
  • 1
    Your Code::Blocks project must be linking against GTK+ 2. You will need to either fix your project or change your code, as the drawing models changed entirely between GTK+ 2 and GTK+ 3. – andlabs Jan 12 '16 at 21:23
  • @andlabs could you help me on how to fix my project to solve this problem? From what I get from you I need to link my project to GTK+3. I'm not that experienced in programming or IDE's and would be helpful if you could teach me how to solve this. Thank you! – tvaz Jan 12 '16 at 21:51
  • Unfortunately I don't know how to use Code::Blocks; sorry. Perhaps someone else will know... – andlabs Jan 12 '16 at 22:11
  • Thanks a lot, @andlabs! I configured codeblocks script project and worked! Here is the solution: http://stackoverflow.com/questions/24339805/how-to-fix-the-codeblocks-wizard-to-look-for-gtk-3-0-and-not-2-0 – tvaz Jan 12 '16 at 22:49
  • since the 'working' method uses `pkg-config --cflags --libs gtk+-3.0`, why are you setting the `compiler-other` options to `pkg-config --cflags --libs cairo` and `pkg-config --libs cairo` when what is needed is: `pkg-config --cflags --libs gtk+-3.0`? – user3629249 Jan 12 '16 at 22:55

1 Answers1

0

When you declare an override method, the implementation of this method must exist at compile time.

marc
  • 1