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+ Discussion :

Gtk - Warning: Could Not Find Signal Handler


Sujet :

GTK+

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre averti
    Homme Profil pro
    Étudiant
    Inscrit en
    Octobre 2014
    Messages
    21
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 30
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Octobre 2014
    Messages : 21
    Par défaut Gtk - Warning: Could Not Find Signal Handler
    Bonjour tout le monde.
    Je suis étudiant en cycle de prepa intégré dans une école d'ingénieur en informatique.
    Je cherche à faire une interface pour un programme et j'ai donc choisi d'utiliser la bibliothèque gtk.
    C'est cette année que je découvre linux, code blocks, les makefiles ou les commandes de compilation qu'il faut ajouter dans les build options...blablabla
    Donc peut être que mon problème viens de là aussi et si vous avez des remarques à me faire sur n'importe quoi allez y, je suis là pour apprendre.^^
    Merci d'avance à vous.

    Voici mes trois fichiers sources que j'utilise:
    callback.ccallback.hmain.c

    Voilà mes paramètres de compilations:
    Dans build options -> debug -> compiler settings -> other options j'ai:
    `pkg-config --cflags gtk+-2.0`
    `gcc -c main.c -o main.o $(pkg-config --cflags gtk+-2.0 gmodule-2.0)`
    `gcc -c callback.c -o callback.o $(pkg-config --cflags gtk+-2.0 gmodule-2.0)`
    `gcc -o main main.o callback.o $(pkg-config --libs gtk+-2.0 gmodule-2.0)`
    Dans build options -> debug -> linker settings -> other linker options j'ai:
    `pkg-config --libs gtk+-2.0`
    Et enfin voilà les détails de mon fichier xml:

    Code xml : 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
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    <?xml version="1.0" encoding="UTF-8"?>
    <interface>
      <requires lib="gtk+" version="2.24"/>
      <!-- interface-naming-policy project-wide -->
      <object class="GtkWindow" id="main_window">
        <property name="can_focus">False</property>
        <property name="border_width">6</property>
        <property name="title" translatable="yes">VOLCARM</property>
        <property name="window_position">center</property>
        <property name="default_width">1500</property>
        <property name="default_height">800</property>
        <signal name="destroy" handler="gtk_main_quit" swapped="no"/>
        <child>
          <object class="GtkVBox" id="vbox">
            <property name="visible">True</property>
            <property name="can_focus">False</property>
            <child>
              <object class="GtkStatusbar" id="statusbar">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="spacing">2</property>
              </object>
              <packing>
                <property name="expand">False</property>
                <property name="fill">True</property>
                <property name="pack_type">end</property>
                <property name="position">0</property>
              </packing>
            </child>
            <child>
              <object class="GtkHBox" id="hbox">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <child>
                  <object class="GtkScrolledWindow" id="scrolledwindow1">
                    <property name="width_request">620</property>
                    <property name="visible">True</property>
                    <property name="can_focus">True</property>
                    <property name="hscrollbar_policy">automatic</property>
                    <property name="vscrollbar_policy">automatic</property>
                    <child>
                      <object class="GtkViewport" id="viewport1">
                        <property name="visible">True</property>
                        <property name="can_focus">False</property>
                        <child>
                          <object class="GtkImage" id="image">
                            <property name="visible">True</property>
                            <property name="can_focus">False</property>
                            <property name="stock">gtk-missing-image</property>
                            <property name="icon-size">6</property>
                            <signal name="button-press-event" handler="cb_loadimage" swapped="no"/>
                          </object>
                        </child>
                      </object>
                    </child>
                  </object>
                  <packing>
                    <property name="expand">False</property>
                    <property name="fill">True</property>
                    <property name="position">0</property>
                  </packing>
                </child>
                <child>
                  <object class="GtkScrolledWindow" id="scrolledwindow2">
                    <property name="visible">True</property>
                    <property name="can_focus">True</property>
                    <property name="hscrollbar_policy">automatic</property>
                    <property name="vscrollbar_policy">automatic</property>
                    <child>
                      <object class="GtkViewport" id="viewport2">
                        <property name="visible">True</property>
                        <property name="can_focus">False</property>
                        <child>
                          <object class="GtkTextView" id="textview">
                            <property name="visible">True</property>
                            <property name="can_focus">True</property>
                          </object>
                        </child>
                      </object>
                    </child>
                  </object>
                  <packing>
                    <property name="expand">True</property>
                    <property name="fill">True</property>
                    <property name="position">1</property>
                  </packing>
                </child>
              </object>
              <packing>
                <property name="expand">True</property>
                <property name="fill">True</property>
                <property name="pack_type">end</property>
                <property name="position">1</property>
              </packing>
            </child>
          </object>
        </child>
      </object>
    </interface>

  2. #2
    Expert confirmé
    Avatar de gerald3d
    Homme Profil pro
    Conducteur de train
    Inscrit en
    Février 2008
    Messages
    2 308
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 55
    Localisation : France, Côte d'Or (Bourgogne)

    Informations professionnelles :
    Activité : Conducteur de train
    Secteur : Transports

    Informations forums :
    Inscription : Février 2008
    Messages : 2 308
    Billets dans le blog
    5
    Par défaut
    Bonjour.

    Tout d'abord, lorsque tu affiches du code encadre-le avec les balises "code" prévues (le dièse dans les icônes au dessus de l'éditeur de post). C'est plus facile à lire pour nous, pauvres lecteurs que nous sommes .

    Pour ce qui est de ton code il fonctionne correctement chez moi ! Je suppose que le problème peut provenir lors de l'assemblage de ton application. Il manque semble-t-il cette option :
    • `pkg-config gmodule-2.0 --libs`


    Deux petites remarques pour finir.
    1. Tu alloues dans le tas data. Je n'en vois pas l'utilité ici. Puisque cette donnée est valide tout au long du processus, tu peux déclarer simplement une variable du type OCRData et propager son pointeur à tes fonctions callback.
    2. Tu détruis builder avant la fin de ton processus. Par expérience j'ai tendance à propager ce pointeur dans mes fonctions callback. Il arrive très souvent d'avoir besoin d'accéder à un widget quelconque de ton interface. Je le détruirais donc à la sortie de la boucle gtkmain();. C'est un point de vue .

  3. #3
    Membre averti
    Homme Profil pro
    Étudiant
    Inscrit en
    Octobre 2014
    Messages
    21
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 30
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Octobre 2014
    Messages : 21
    Par défaut
    J'ai décidé de reprendre le projet à zéro sur vim. Pour l'insant je suis ce tutoriel: http://gerald3d.developpez.com/tutoriels/gtk/glade3/

    Cependant, j'ai un problème de compilation, sûrement lié à mon Makefile. J'ai cette erreur:
    gcc -o main.o -c main.c -Wall -Werror -Wextra -std=c99 -O2 `pkg-config --libs gmodule-2.0` `pkg-config --cflags gtk+-2.0`
    gcc -lm `pkg-config --libs gmodule-2.0` `pkg-config --libs gtk+-2.0` main.o -o main
    main.o: dans la fonction « main »:
    main.c:(.text.startup+0x20): référence indéfinie vers « gtk_init »
    main.c:(.text.startup+0x25): référence indéfinie vers « gtk_builder_new »
    main.c:(.text.startup+0x36): référence indéfinie vers « g_build_filename »
    main.c:(.text.startup+0x49): référence indéfinie vers « gtk_builder_add_from_file »
    main.c:(.text.startup+0x51): référence indéfinie vers « g_free »
    main.c:(.text.startup+0x6e): référence indéfinie vers « g_printerr »
    main.c:(.text.startup+0x78): référence indéfinie vers « g_error_free »
    main.c:(.text.startup+0x86): référence indéfinie vers « gtk_widget_get_type »
    main.c:(.text.startup+0x96): référence indéfinie vers « gtk_builder_get_object »
    main.c:(.text.startup+0xa1): référence indéfinie vers « g_type_check_instance_cast »
    main.c:(.text.startup+0xb1): référence indéfinie vers « g_type_check_instance_cast »
    main.c:(.text.startup+0xbe): référence indéfinie vers « gtk_main_quit »
    main.c:(.text.startup+0xcb): référence indéfinie vers « g_signal_connect_data »
    main.c:(.text.startup+0xd3): référence indéfinie vers « gtk_widget_show_all »
    main.c:(.text.startup+0xd8): référence indéfinie vers « gtk_main »
    collect2: error: ld returned 1 exit status
    make: *** [main] Erreur 1
    Voici mon makefile:
    Code makefile : 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
    CC=gcc
    CFLAGS=-Wall -Werror -Wextra -std=c99 -O2 `pkg-config --libs gmodule-2.0` `pkg-config --cflags gtk+-2.0`
    LDFLAGS=-lm `pkg-config --libs gmodule-2.0` `pkg-config --libs gtk+-2.0`
    EXEC=test
     
    all: $(EXEC)
     
    test: main.o
            $(CC) -o $@ $^ $(LDFLAGS)
     
    main.o: main.c
            $(CC) -o $@ -c $< $(CFLAGS)
     
    clean:
            rm -rf *.o
     
    mrproper: clean
            rm -rf $(EXEC)

    Voici le fichier source:
    main.c

    Et mon fichier glade:
    Code xml : 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
    <?xml version="1.0" encoding="UTF-8"?>
    <!-- Generated with glade 3.16.1 -->
    <interface>
      <requires lib="gtk+" version="3.10"/>
      <object class="GtkWindow" id="MainWindow">
        <property name="can_focus">False</property>
        <child>
          <object class="GtkBox" id="box1">
            <property name="visible">True</property>
            <property name="can_focus">False</property>
            <property name="orientation">vertical</property>
            <child>
              <object class="GtkMenuButton" id="menubutton1">
                <property name="visible">True</property>
                <property name="can_focus">True</property>
                <property name="receives_default">True</property>
                <child>
                  <placeholder/>
                </child>
              </object>
              <packing>
                <property name="expand">False</property>
                <property name="fill">True</property>
                <property name="position">0</property>
              </packing>
            </child>
            <child>
              <object class="GtkScrolledWindow" id="scrolledwindow1">
                <property name="visible">True</property>
                <property name="can_focus">True</property>
                <property name="shadow_type">in</property>
                <child>
                  <object class="GtkTextView" id="TextView">
                    <property name="visible">True</property>
                    <property name="can_focus">True</property>
                  </object>
                </child>
              </object>
              <packing>
                <property name="expand">True</property>
                <property name="fill">True</property>
                <property name="position">1</property>
              </packing>
            </child>
            <child>
              <object class="GtkStatusbar" id="StatusBar">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="margin_left">10</property>
                <property name="margin_right">10</property>
                <property name="margin_top">6</property>
                <property name="margin_bottom">6</property>
                <property name="orientation">vertical</property>
                <property name="spacing">2</property>
              </object>
              <packing>
                <property name="expand">False</property>
                <property name="fill">False</property>
                <property name="position">2</property>
              </packing>
            </child>
          </object>
        </child>
      </object>
    </interface>

    Merci d'avance si vous avez une solution.^^

  4. #4
    Expert confirmé
    Avatar de gerald3d
    Homme Profil pro
    Conducteur de train
    Inscrit en
    Février 2008
    Messages
    2 308
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 55
    Localisation : France, Côte d'Or (Bourgogne)

    Informations professionnelles :
    Activité : Conducteur de train
    Secteur : Transports

    Informations forums :
    Inscription : Février 2008
    Messages : 2 308
    Billets dans le blog
    5
    Par défaut
    Je vois que tu compiles avec Gtk+2.0. Est-ce bien cette version qui est installée sur ta machine ? La version courante est la 3.14.5.

  5. #5
    Membre averti
    Homme Profil pro
    Étudiant
    Inscrit en
    Octobre 2014
    Messages
    21
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 30
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Octobre 2014
    Messages : 21
    Par défaut
    En fait j'utilise la version 3.16, c'est écrit dans le fichier glade. Et je viens de lire que celà requiert la version 3.10 au moins... D'accord je vois je vois. Il faut que je fasse quoi dans ce cas? Enfin, je dois écrire quoi exactement?

  6. #6
    Membre averti
    Homme Profil pro
    Étudiant
    Inscrit en
    Octobre 2014
    Messages
    21
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 30
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Octobre 2014
    Messages : 21
    Par défaut
    Ah en fait j'ai vérifié, c'est la version 2.0 qui est installée sur mon ordi. Il faut donc que j'installe une version supérieur ou égale à la 3.10. D'accord, et ensuite qu'est ce que je dois écrire dans les options de lien et les options de compilation?

Discussions similaires

  1. Erreur could not find signal handler
    Par moncef363 dans le forum GTK+
    Réponses: 4
    Dernier message: 06/06/2013, 14h08
  2. Réponses: 2
    Dernier message: 17/06/2010, 08h54
  3. Réponses: 2
    Dernier message: 12/04/2010, 17h47
  4. Gtk-WARNING **: Could not find signal handler
    Par yostane dans le forum GTK+ avec C & C++
    Réponses: 2
    Dernier message: 24/11/2008, 14h07

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