-1

My c code uses 'show_error_message' (GTK2)

#include <gnome.h>
#include <profiles/audio-profile.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>

..........................................................................

static void error_cb(GstBus *bus, GstMessage *message, gpointer user_data)
{
    GError *error = NULL;
    GstElement *pipeline = user_data;
    g_assert(pipeline);

    /* Make sure the pipeline is not running any more */
    gst_element_set_state (pipeline, GST_STATE_NULL);

    gst_message_parse_error(message, &error, NULL);
    show_error_message(_("GStreamer runtime error."), error->message);
    g_error_free(error);
}

get these warning:

warning: implicit declaration of function 'show_error_message'

and

#include <config.h>
#include <gnome.h>
#include <gconf/gconf-client.h>
#include <math.h>

.................................................

        /* Initizialize Gconf */
    if (!gconf_init(argc, argv, &err)) {
        char *details;
        details = g_strdup_printf(_("%s\n\nChanges to the settings won't be saved."), err->message);
        show_warning_message(_("Failed to init GConf!"), details);
        g_error_free(err); 
        g_free(details);
        err = NULL;
    } else {
        gconf_client_set_global_default_error_handler((GConfClientErrorHandlerFunc)gconf_error_handler);
        gconf_client_set_error_handling(gconf_client_get_default(),  GCONF_CLIENT_HANDLE_ALL);
        gnome_media_profiles_init(gconf_client_get_default());
    }

get these warning:

warning: implicit declaration of function 'gnome_media_profiles_init'

........................................................ Can you please tell me how can I resolve these warnings?

Thank you.

geo
  • 193
  • 1
  • 1
  • 8
  • you can actually google this warning and solve it yourself http://stackoverflow.com/questions/8440816/warning-implicit-declaration-of-function – chikuba Apr 18 '12 at 21:00
  • you provide no headerfiles or anything that could be the root of the issue. the functions themselves are not the cause why this is failing – chikuba Apr 18 '12 at 21:09

1 Answers1

0

Firstly, if you dont have a headerfile, all the functions that are used in main or some other function, most be declared above it.

void function();

int main() {
    function();
}

If you have a headerfile (assume that you dont since you did not provide me with one even though i asked) you should declare all the functions there and then include the headerfile.

//something.h

void function();

//something.c

#include "something.h"
int main() {
    function();
}
chikuba
  • 4,229
  • 6
  • 43
  • 75