GTK+ Forums Forum Index GTK+ Forums
Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

casting quiestion

 
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Programming
Author Message
Peter
GTK+ Geek


Joined: 10 May 2008
Posts: 54

PostPosted: Mon May 19, 2008 12:51 pm    Post subject: casting quiestion Reply with quote

I keep getting compiler warning, although I have (I think) the right types:

What are the proper casting (macros) to use?
Where can I find the list of macros?

Thanks, Peter

Code: (C)
1
2
3
4
5
6
7
8
9
10
11
12
13
14

myfunc()
{
GtkTreeModel *model;
GtkTreeStore *store;
 ...
    model = gtk_tree_view_get_model(GTK_TREE_VIEW(view));
    store = GTK_LIST_STORE ( model );  //   warning: assignment from incompatible pointer type


 
gtk_list_store_append (store, &iter); // passing argument 1 of ‘gtk_list_store_append’ from incompatible pointer type
...
}
Back to top
luhuadeng
Familiar Face


Joined: 05 May 2008
Posts: 10

PostPosted: Mon May 19, 2008 1:10 pm    Post subject: Re: casting quiestion Reply with quote

Peter wrote:
I keep getting compiler warning, although I have (I think) the right types:

What are the proper casting (macros) to use?
Where can I find the list of macros?

Thanks, Peter
Code: (Plaintext)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

[code=c][/code]
myfunc()
{
GtkTreeModel *model;
GtkTreeStore *store;
 ...
    model = gtk_tree_view_get_model(GTK_TREE_VIEW(view));
    store = GTK_LIST_STORE ( model );  //   warning: assignment from incompatible pointer type


  gtk_list_store_append (store, &iter); // passing argument 1 of ‘gtk_list_store_append’ from incompatible pointer type
...
}


Macro of type cast in GTK , have some custom.
the warning in your code is cause

Code: (Plaintext)
1
2
3
4

GtkTreeStore *store;
store = GTK_LIST_STORE ( model );


As in the definition variable store is GtkTreeStore but you use GTK_LIST_STORE .
You should use
Code: (Plaintext)
1
2
3

GtkListStore *store ;

to define your variable.
Back to top
Peter
GTK+ Geek


Joined: 10 May 2008
Posts: 54

PostPosted: Mon May 19, 2008 1:29 pm    Post subject: Reply with quote

:D Thank you!
Back to top
Display posts from previous:   
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Programming All times are GMT
Page 1 of 1

 


Powered by phpBB © 2001, 2005 phpBB Group
CodeBB 1.0 Beta 2
Protected by Anti-Spam ACP