IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

GTK+ avec C & C++ Discussion :

Makefile avec Gtk


Sujet :

GTK+ avec C & C++

  1. #1
    Membre averti
    Inscrit en
    Mai 2009
    Messages
    13
    Détails du profil
    Informations forums :
    Inscription : Mai 2009
    Messages : 13
    Par défaut Makefile avec Gtk
    Bonjour à tous,
    Merci pour les tutos que j'ai trouvé sur votre site et qui ù'ont été d'une grande aide.
    Je souhaite faire un makefile avec du Gtk, voilà ce que j'ai fait mais qui me renvoie plein d'erreur en rapport avec gtk:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    all: boucle.o calcul.o gtk.o
    	gcc gtk.o boucle.o calcul.o -o solveur
     
    gtk.o: gtk.c
    	gcc $(pkg-config --libs --cflags gtk+-2.0) gtk.c -o gtk.o
     
    boucle.o: boucle.c calcul.c
    	gcc -c boucle.c -o boucle.o
     
    calul.o: calcul.c
    	gcc -c calcul.c -o calcul.o
     
    clean:
    	rm -rf *.o
    Je vous remercie par avance.

  2. #2
    Membre Expert
    Homme Profil pro
    Inscrit en
    Janvier 2005
    Messages
    1 259
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Janvier 2005
    Messages : 1 259
    Par défaut
    "plein d'erreur en rapport avec gtk", ça n'est pas très précis comme description de ton problème...

  3. #3
    Membre averti
    Inscrit en
    Mai 2009
    Messages
    13
    Détails du profil
    Informations forums :
    Inscription : Mai 2009
    Messages : 13
    Par défaut
    Oui effectivement.
    Si je fais la compilation directement dans la console en faisant:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    gcc $(pkg-config --libs --cflags gtk+-2.0) gtk.c -o gtk
    Tout se passe s'en problème. Je peux afficher ma fenêtre gtk en tapant ./gtk
    Maintenant j'ai appellé une fonction dans gtk.c qui est définit dans boucle.c
    c'est pour quoi je fais appel à boucle.o dans mon makefile


    Si maintenant je fais le makefile comme précedemment ou j'ai corrigé une petite erreur:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    all: boucle.o calcul.o gtk.o
    	gcc gtk.o boucle.o calcul.o -o solveur
     
    gtk.o: gtk.c boucle.c
    	gcc $(pkg-config --libs --cflags gtk+-2.0) gtk.c -o gtk.o
     
    boucle.o: boucle.c calcul.c
    	gcc -c boucle.c -o boucle.o
     
    calul.o: calcul.c
    	gcc -c calcul.c -o calcul.o
     
    clean:
    	rm -rf *.o
    alors là, la console m'affiche plein d'erreur qui sont:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    gcc  gtk.c -o gtk.o
    gtk.c:2:21: error: gtk/gtk.h: Aucun fichier ou dossier de ce type
    gtk.c:7: erreur: expected ‘)’ before ‘*’ token
    gtk.c:8: erreur: expected ‘)’ before ‘*’ token
    gtk.c:9: erreur: expected ‘)’ before ‘*’ token
    gtk.c:14: erreur: expected ‘=’, ‘,’, ‘;’, ‘asmor ‘__attribute__’ before ‘*’ token
    gtk.c: In function ‘main’:
    gtk.c:18: erreur: ‘GtkWidget’ undeclared (first use in this function)
    gtk.c:18: erreur: (Each undeclared identifier is reported only once
    gtk.c:18: erreur: for each function it appears in.)
    gtk.c:18: erreur: ‘MainWindow’ undeclared (first use in this function)
    gtk.c:18: erreur: ‘pTable’ undeclared (first use in this function)
    gtk.c:18: erreur: ‘pVBox’ undeclared (first use in this function)
    gtk.c:18: erreur: ‘pMenuBar’ undeclared (first use in this function)
    gtk.c:18: erreur: ‘pMenu’ undeclared (first use in this function)
    gtk.c:18: erreur: ‘pMenuItem’ undeclared (first use in this function)
    gtk.c:18: erreur: ‘pButton’ undeclared (first use in this function)
    gtk.c:18: erreur: ‘pLabel’ undeclared (first use in this function)
    gtk.c:18: erreur: ‘pFrame’ undeclared (first use in this function)
    gtk.c:18: erreur: ‘pSpin’ undeclared (first use in this function)
    gtk.c:18: erreur: ‘pAffi’ undeclared (first use in this function)
    gtk.c:18: erreur: ‘pEssai’ undeclared (first use in this function)
    gtk.c:18: erreur: ‘vscrollbar’ undeclared (first use in this function)
    gtk.c:19: erreur: ‘box’ undeclared (first use in this function)
    gtk.c:20: erreur: ‘text_view’ undeclared (first use in this function)
    gtk.c:21: erreur: ‘gchar’ undeclared (first use in this function)
    gtk.c:21: erreur: ‘sUtf8’ undeclared (first use in this function)
    gtk.c:23: erreur: ‘GtkTextView’ undeclared (first use in this function)
    gtk.c:23: erreur: ‘p_text_view’ undeclared (first use in this function)
    gtk.c:24: erreur: ‘text’ undeclared (first use in this function)
    gtk.c:31: erreur: ‘GTK_WINDOW_TOPLEVEL’ undeclared (first use in this function)
    gtk.c:32: erreur: ‘gtk_main_quit’ undeclared (first use in this function)
    gtk.c:36: erreur: expected ‘=’, ‘,’, ‘;’, ‘asmor ‘__attribute__’ before ‘*’ token
    gtk.c:36: erreur: ‘GtkWindow’ undeclared (first use in this function)
    gtk.c:36: erreur: ‘window’ undeclared (first use in this function)
    gtk.c:36: erreur: invalid type argument of ‘unary *’ (have ‘int)
    gtk.c:42: erreur: ‘GTK_WIN_POS_CENTER’ undeclared (first use in this function)
    gtk.c:48: erreur: ‘TRUE’ undeclared (first use in this function)
    gtk.c:72: erreur: ‘pCase’ undeclared (first use in this function)
    gtk.c:102: erreur: expected expression before ‘)’ token
    gtk.c:106: erreur: expected expression before ‘)’ token
    gtk.c:114: erreur: ‘OnQuitter’ undeclared (first use in this function)
    gtk.c:114: erreur: expected expression before ‘)’ token
    gtk.c:135: erreur: ‘OnAbout’ undeclared (first use in this function)
    gtk.c:135: erreur: expected expression before ‘)’ token
    gtk.c: In function ‘OnOuvrir’:
    gtk.c:164: erreur: ‘GtkWidget’ undeclared (first use in this function)
    gtk.c:164: erreur: ‘selection’ undeclared (first use in this function)
    gtk.c:171: erreur: ‘TRUE’ undeclared (first use in this function)
    gtk.c:173: erreur: invalid type argument of ‘->’ (have ‘int)
    gtk.c:173: erreur: ‘recuperer_chemin’ undeclared (first use in this function)
    gtk.c:175: erreur: invalid type argument of ‘->’ (have ‘int)
    gtk.c:175: erreur: ‘gtk_widget_destroy’ undeclared (first use in this function)
    gtk.c: Hors de toute fonction :
    gtk.c:178: erreur: expected ‘)’ before ‘*’ token
    gtk.c: In function ‘OnSave’:
    gtk.c:191: erreur: ‘GtkWidget’ undeclared (first use in this function)
    gtk.c:191: erreur: ‘selection’ undeclared (first use in this function)
    gtk.c:198: erreur: ‘TRUE’ undeclared (first use in this function)
    gtk.c:200: erreur: invalid type argument of ‘->’ (have ‘int)
    gtk.c:200: erreur: ‘recuperer_chemin’ undeclared (first use in this function)
    gtk.c:201: erreur: invalid type argument of ‘->’ (have ‘int)
    gtk.c:201: erreur: ‘gtk_widget_destroy’ undeclared (first use in this function)
    gtk.c: Hors de toute fonction :
    gtk.c:204: erreur: expected ‘)’ before ‘*’ token
    gtk.c:219: erreur: expected ‘)’ before ‘*’ token
    make: *** [gtk.o] Erreur 1
    J'espère que ça répond à ta question sur les erreurs qui s'affichent.

  4. #4
    Membre Expert
    Homme Profil pro
    Inscrit en
    Janvier 2005
    Messages
    1 259
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Janvier 2005
    Messages : 1 259
    Par défaut
    Dans ton Makefile, tu as mis :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    	gcc $(pkg-config --libs --cflags gtk+-2.0) gtk.c -o gtk.o
    pour compiler gtk.c, dans la partie que tu copies colles, tu as :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    gcc  gtk.c -o gtk.o
    La partie $(pkg-config ...) a donc été remplacée par rien, ton problème vient de là. Je ne suis pas suffisamment bon en Makefile pour te dire ce qu'il faut faire pour corriger ce souci

  5. #5
    Membre averti
    Inscrit en
    Mai 2009
    Messages
    13
    Détails du profil
    Informations forums :
    Inscription : Mai 2009
    Messages : 13
    Par défaut
    Merci mais j'ai trouvé la réponse à ma question, j'ai oublié de situer le paquet sur la première ligne; Si ça peut aider d'autres personnes, voilà mon makefile:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    all: boucle.o calcul.o gtk.o
    	gcc gtk.o boucle.o calcul.o `pkg-config --libs gtk+-2.0` -o solveur
     
    gtk.o: gtk.c boucle.c
    	gcc -c `pkg-config --cflags gtk+-2.0` gtk.c 
     
    boucle.o: boucle.c calcul.c
    	gcc -c boucle.c -o boucle.o
     
    calul.o: calcul.c
    	gcc -c calcul.c -o calcul.o
     
    clean:
    	rm -rf *.o

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. [GTK]problème avec GTK+ sur DEV-C++
    Par afrikha dans le forum Dev-C++
    Réponses: 7
    Dernier message: 01/10/2005, 14h13
  2. Réponses: 1
    Dernier message: 18/06/2004, 01h12
  3. [GTK]installer Dev-C++ avec gtk 1.2 ...
    Par vbcasimir dans le forum Dev-C++
    Réponses: 2
    Dernier message: 02/02/2004, 13h34

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo