Ask Your Question
0

Using GTK+ 2.x and GTK+ 3 in the same process

asked 2013-11-09 12:09:59 -0500

SaeedMasoumi gravatar image

updated 2013-11-10 14:49:49 -0500

skytux gravatar image

Hi

i have a problem in code::blocks

while i create a gtk project and build it(successfully built) but when i run it it says

Gtk-ERROR **: GTK+ 2.x symbols detected. Using GTK+ 2.x and GTK+ 3 in the same process is not supported

please help me thanks

#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;
}
edit retag flag offensive close merge delete

Comments

Please show the code.

skytux gravatar imageskytux ( 2013-11-10 07:15:15 -0500 )edit

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; }

SaeedMasoumi gravatar imageSaeedMasoumi ( 2013-11-10 10:06:51 -0500 )edit

2 Answers

Sort by » oldest newest most voted
0

answered 2013-11-10 15:20:24 -0500

skytux gravatar image

updated 2013-11-10 15:21:23 -0500

If you want people to be able to reproduce your errors, you need to show everything you do. You are not showing how you compiled the code, so I have to guess here.

I'm not a C programmer, but I made a test and it works fine for me:

With Gtk+ 2:

$ cc `pkg-config --libs --cflags gtk+-2.0` test.c -o test

$ ldd test | grep -i gtk
libgtk-x11-2.0.so.0 => /usr/lib64/libgtk-x11-2.0.so.0 (0x000000300c400000)

With Gtk+ 3:

$ cc `pkg-config --libs --cflags gtk+-3.0` test.c -o test

$ ldd test | grep -i gtk
libgtk-3.so.0 => /usr/lib64/libgtk-3.so.0 (0x0000003011200000)

HTH,

Germán.

edit flag offensive delete link more

Comments

i can also compile with anjuta and terminal but in code::blocks it gives me an error that i explain

SaeedMasoumi gravatar imageSaeedMasoumi ( 2013-11-12 02:34:10 -0500 )edit

I don't have much more experience in C programming. I use Gedit for programming in Python, Fortran, Bash and spec files, and I use plugins and scripts that help me in the tasks of compiling and running. I code in Gtk+, but using PyGObject not C.

skytux gravatar imageskytux ( 2013-11-12 13:35:30 -0500 )edit
0

answered 2013-11-10 23:54:54 -0500

SaeedMasoumi gravatar image

i open a gtk project in code::blocks , then add pkg-config --libs gtk+-3.0 in linker and compile option then compile and run my sample code but it gives me the error that i told you

edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-11-09 12:09:59 -0500

Seen: 3,472 times

Last updated: Nov 10 '13