Re: compile error wiith gtk_text_new(NULL, NULL)



On Wednesday 12 November 2003 04:05, chenjun1 egr msu edu wrote:

But I met the below error when compiling my code.

[root localhost GTK]# gcc scrollview.c -o scrollview `pkg-config --cflags
--libs gtk+-2.0`
scrollview.c: In function `main':
scrollview.c:55: warning: assignment makes pointer from integer without a
cast

/tmp/cc5tJ3iP.o(.text+0x23b): In function `main':
: undefined reference to `GTK_TEXT'
/tmp/cc5tJ3iP.o(.text+0x2a3): In function `main':
: undefined reference to `GTK_TEXT'
/tmp/cc5tJ3iP.o(.text+0x2dd): In function `main':
: undefined reference to `GTK_TEXT'
collect2: ld returned 1 exit status

Is it because of the version of my GTK files are too old? Or something
else?

The reason for this can be found in the API reference:

    http://developer.gnome.org/doc/API/2.0/gtk/GtkText.html

--- quote -------------------------------------

WARNING

GtkText is deprecated and unsupported. It is known to be buggy. To use it, you 
must define the symbol GTK_ENABLE_BROKEN prior to including the GTK+ header 
files. Use GtkTextView instead.

--- quote end -------------------------------------

In other words: if you do

#define GTK_ENABLE_BROKEN
#include <gtk/gtk.h>

it will compile fine.

Cheers
-Tim






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