Re: easy gtk-programm fault
- From: Bernd Muent <Bernd Muent euroscript de>
- To: gtk-app-devel-list gnome org
- Subject: Re: easy gtk-programm fault
- Date: Tue, 17 Jan 2006 15:37:36 +0100
Daniel Dieterle schrieb:
> since some days i try to code my first gtk program. it 's not more 
than a window with a label in it.
> the code is that:
>> #include <gtk/gtk.h>
>>
>>
>> int main( int argc,
>>                 char *argv[] )
>> {
[]
>>         GtkWidget *label1;
>>                 gtk_init (&argc, &argv);
>>
[]
>>         label1 = gtk_label_new ("Hallo Du");
>>
>> //      gtk_label_set_text (label1,"wie gehts?");
> but my aim is to change the text in the label. and if i uncomment the 
"gkt_label_set_text ..."-line, gcc (gcc label.c `pkg-config --cflags 
--libs gtk+-2.0`) shows a warning:
>> label.c: In Funktion »main«:
>> label.c:22: Warnung: Verarbeiten des Argumentes 1 von 
»gtk_label_set_text« von inkompatiblem Zeigertyp
> which means that the "label1" in the "set_text"-line is a 
incompatible pointertype, i think.
Use gtk_label_set_text (GTKL_LABEL(label1),"wie gehts?");
You declared label1 as a GtkWidget, so you have to cast using this macro.
Greetings, Bernd
--
Bernd Münt                   Durchwahl: 030/69032-509
euroscript Deutschland GmbH  Zentrale:  030/69032-300
Abteilung IT-Management      Fax:       030/69032-505
Alt-Moabit 91                Mail:      Bernd Muent euroscript de
10559 Berlin                 Web:       http://www.euroscript.de
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]