Pointers 来自不兼容指针类型(结构)c的赋值
对于结构Pointers 来自不兼容指针类型(结构)c的赋值,pointers,struct,gtk,Pointers,Struct,Gtk,对于结构 typedef struct Recording_Settings recording_settings; struct Recording_Settings { gchar *profile; gchar *destination; }; recording_settings rec_settings; 我尝试这样做时会收到警告 static void profile_combo_change_cb(GtkComboBox *combo, gpointer use
typedef struct Recording_Settings recording_settings;
struct Recording_Settings
{
gchar *profile;
gchar *destination;
};
recording_settings rec_settings;
我尝试这样做时会收到警告
static void profile_combo_change_cb(GtkComboBox *combo, gpointer userdata)
{
GtkTreeIter iter;
GtkTreeModel *model;
/* Grab the encoding profile choosen */
model = gtk_combo_box_get_model (GTK_COMBO_BOX (combo));
if (gtk_combo_box_get_active_iter(GTK_COMBO_BOX(combo), &iter)) {
gchar *media_type;
gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, 0, &media_type, -1);
rec_settings.profile = rb_gst_get_encoding_profile(media_type); // Warning: assignment from incompatible pointer type
g_free (media_type);
}
}
我是误解了还是遗漏了什么
谢谢。rb\u gst\u get\u encoding\u profile的类型似乎是
GstEncodingProfile *rb_gst_get_encoding_profile (const char *media_type);
但将其返回值指定给gchar*
据我所知,GstEncodingProfile
是一种struct
类型(typedef struct\u GstEncodingProfile GstEncodingProfile;
),而gchar
可能是字符类型的typedef
(最有可能是glib的typedef char gchar;
)。因此,这些类型将是不兼容的