LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   How does one surpress incompatible pointer type warnings? (http://www.linuxquestions.org/questions/programming-9/how-does-one-surpress-incompatible-pointer-type-warnings-219418/)

tonyfreeman 08-18-2004 05:54 PM

How does one surpress incompatible pointer type warnings?
 
I need to get the value of a user selected range. The code below returns the values I want, but there are warnings. Is there a better way to write the code to avoid warnings? If not, then what can I do to surpress the warnings?

Code:

void get_user_input (GtkButton *button, gpointer user_data)
{
        gdouble start_sun, end_sun;
        GtkRange *hscale_start_sun = lookup_widget(GTK_WIDGET(button), "hscale_start_sun");
        GtkRange *hscale_end_sun = lookup_widget(GTK_WIDGET(button), "hscale_end_sun");
        start_sun = (gdouble)gtk_range_get_adjustment (hscale_start_sun)->value;
        end_sun = (gdouble)gtk_range_get_adjustment (hscale_end_sun)->value;
}

When compiled the code above creates this warning for both the GtkRange lines:

Code:

callbacks.c: In function `get_user_input':
callbacks.c:89: warning: initialization from incompatible pointer type
callbacks.c:90: warning: initialization from incompatible pointer type

-- Tony

P.S. I have to use glade-1.2x and glib-1x because the system uses RedHat 7.2

tonyfreeman 08-18-2004 06:06 PM

I just answered my own question about surpressing the warnings. All I have to do is put (gpointer) in front of the lookup_widget:

Code:

void get_user_input (GtkButton *button, gpointer user_data)
{
        gdouble start_sun, end_sun;

        GtkRange *hscale_start_sun = (gpointer)lookup_widget(GTK_WIDGET(button), "hscale_start_sun");
        GtkRange *hscale_end_sun = (gpointer)lookup_widget(GTK_WIDGET(button), "hscale_end_sun");

        start_sun = (gdouble)gtk_range_get_adjustment (hscale_start_sun)->value;
        end_sun = (gdouble)gtk_range_get_adjustment (hscale_end_sun)->value;
}



All times are GMT -5. The time now is 10:07 AM.