Question

Usually when I get this kind of error message, it means that the struct is hidden from the code and because of that I cannot use the struct's variables directly.

In this case the struct is defined in the same C file.

I pasted the C file at http://bpaste.net/show/224777/

at line 330 I have the following code:

TrackBoxWidget *track_box_widget_new(GtkWidget *track_data_widget,GVariant *audio_in_devices) {
// can add more parameters here
TrackBoxWidget *widget = g_object_new(TRACK_BOX_WIDGET_TYPE,"audio_in_devices", audio_in_devices,NULL);
/*LINE 330*/    widget->track_data_widget=track_data_widget;
...

as you can see I;'m tryuing to set the track_data_widget variable inside widget that is TrackBoxWidget typedef. and somehow i still get this error.

any ideas?

Was it helpful?

Solution

On the left-hand side of your assignment you have widget->track_data_widget, a member of TrackBoxWidget (aka struct _track_box_widget), of type TrackDataWidget*.

On the right-hand side of your assignment you have track_data_widget, the parameter of the track_box_widget_new function, of type GtkWidget*. Since the two pointers are of different types, a direct assignment between them is not allowed without a cast.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top