Thread: Make types struct to be compatible.

  1. #1
    Registered User
    Join Date
    Jan 2013
    Posts
    7

    Make types struct to be compatible.

    How to make this warning clean

    Code:
    typedef struct Recording_Settings recording_settings;
    struct Recording_Settings
    {
        gchar *profile;
        gchar *destination;
    };
    recording_settings rec_settings;
    Code:
    typedef struct _GstEncodingProfile GstEncodingProfile;
    GstEncodingProfile *rb_gst_get_encoding_profile (const char *media_type);
    Warning: assignment from incompatible pointer type:

    Code:
    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);
        }
    }

  2. #2
    TEIAM - problem solved
    Join Date
    Apr 2012
    Location
    Melbourne Australia
    Posts
    1,907
    Does rb_gst_get_encoding_profile does not return a gchar* as rec_settings.profile expects.

    The input for the function is defined as a gchar*, but the prototype expects const char *

    Don't try and suppress the warnings, try to fix them.
    Fact - Beethoven wrote his first symphony in C

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How can I make binary compatible code?
    By inu11byte in forum C Programming
    Replies: 13
    Last Post: 08-10-2012, 07:48 PM
  2. Struct types and dynamic arrays
    By simone.marras in forum C Programming
    Replies: 6
    Last Post: 03-14-2009, 10:56 AM
  3. Finding Struct Types
    By randomalias in forum C Programming
    Replies: 3
    Last Post: 05-17-2006, 08:18 PM
  4. Returning multiple types w/o a struct
    By Trauts in forum C++ Programming
    Replies: 8
    Last Post: 02-27-2003, 11:04 PM
  5. how to make certain file types open IN your program
    By DarkViper in forum Windows Programming
    Replies: 4
    Last Post: 02-06-2003, 11:37 PM