LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 08-18-2004, 05:54 PM   #1
tonyfreeman
Member
 
Registered: Sep 2003
Location: Fort worth, TX
Distribution: Debian testing 64bit at home, EL5 32/64bit at work.
Posts: 187

Rep: Reputation: 30
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
 
Old 08-18-2004, 06:06 PM   #2
tonyfreeman
Member
 
Registered: Sep 2003
Location: Fort worth, TX
Distribution: Debian testing 64bit at home, EL5 32/64bit at work.
Posts: 187

Original Poster
Rep: Reputation: 30
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;
}
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
passing arg 3 of `pthread_create' from incompatible pointer type wallwaters Programming 8 03-08-2010 01:46 AM
What is the warning: passing arg 3 of `pthread_create' from incompatible pointer type wallwaters Linux - Software 3 06-01-2005 08:30 AM
curl "incompatible pointer type" while making PHP basse- Linux - Software 2 04-15-2004 10:21 AM
Getting an incompatible pointer type error... JStew Programming 4 03-06-2003 05:08 PM
Installing Wine - incompatible pointer type orange400 Linux - Software 1 03-03-2003 12:57 AM


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

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration