[beginner] little problem when compiling a basic app
- From: "Marc Heinz" <marc heinz no-log org>
- To: gconf-list gnome org
- Subject: [beginner] little problem when compiling a basic app
- Date: Sat, 16 Aug 2008 12:52:38 +0200 (CEST)
Hello everybody,
Just two words for introducing myself: I'm quite a beginner in programming
on a unix environment, right now I'm trying to do a small app which use
gdk_pixbuf to load an image so I can do various processing on it
afterward.
I started from an example I found some times ago, and I'm currently trying
to improve it. However, I've already some basic compiling problems...
related to gconf it seems. There is what I've got:
--- Makefile ---
CC = gcc
CFLAGS = `pkg-config --cflags gnomeui gdk_pixbuf glib gnome gtk gconf-2.0`
LDFLAGS = `pkg-config --libs gnomeui gdk_pixbuf glib gnome gtk gconf-2.0`
test_pixbuf: test_pixbuf.c
$(CC) test_pixbuf.c -o test $(CFLAGS) $(LDFLAGS)
--- EOF ---
--- test_pixbuf.c ---
#include <gtk/gtk.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <glib.h>
#include <string.h>
// Cause a lot of errors. I suppose it's not inteeded to be included this
way.
// #include <gconf/gconf-client.h>
int main(int argc, char *argv[])
{
GError *gerror; // Line 11
GdkPixbuf *originalpb, *pb;
GdkPixbuf *rpb, *ipb;
char filename[20];
gtk_set_locale ();
gtk_init (&argc, &argv);
strcpy(filename, argv[1]);
originalpb = NULL;
originalpb = gdk_pixbuf_new_from_file(filename);
if(!originalpb) {
printf("error message: %s\n", gerror->message);
exit(1);
}
gdk_pixbuf_unref(originalpb);
return 0;
}
--- EOF ---
When runnig my makefile, the compiler give me:
test_pixbuf.c: In function « main »:
test_pixbuf.c:11: error: `GError' undeclared (first use in this function)
test_pixbuf.c:11: error: (Each undeclared identifier is reported only once
test_pixbuf.c:11: error: for each function it appears in.)
test_pixbuf.c:11: error: `gerror' undeclared (first use in this function)
make: *** [test_pixbuf] Erreur 1
If I comment the problematic line (and all the gerror references),
everything goes fine.
As far as I know, all the needed library are installed (on a up-to-date
Debian sid: libgconf2-4, libgconf2-dev, gconf2,
libglib2.0-0,libglib2.0-dev, gdk-imlib11, etc.), I suppose it must be a
missing include or maybe some parameter I should give to pkg-config. I've
tried a lot of combinations but still no luck.
Any help would be greatly appreciated. If you have also some good
suggestion to start coding with all the gnome-related libs (and how to
deals with such problems)...
Thank you very much
MH.
[
Date Prev][
Date Next] [
Thread Prev][Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]