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 :

debugger une application gtk


Sujet :

GTK+ avec C & C++

  1. #1
    Membre confirmé Avatar de Gamall
    Profil pro
    Étudiant ENSEA
    Inscrit en
    Août 2009
    Messages
    252
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant ENSEA

    Informations forums :
    Inscription : Août 2009
    Messages : 252
    Par défaut debugger une application gtk
    Bonjour,
    Lorsque je debugger une application gtk, j'ai ce message d'erreur:

    Code x : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    (gdb) break 51
    Breakpoint 1 at 0x8048d70: file calculatrice.c, line 51.
    (gdb) run
    Starting program: /home/artificier/Programmation/glade/tut 
    [Thread debugging using libthread_db enabled]
    Error while reading shared library symbols:
    Cannot find new threads: generic error
    Cannot find new threads: generic error
    (gdb)

    Je ne comprends pas trop pourquoi surtout, que auparavant, il m'a demandé d'installer un 20aine de paquets debug, glibc-debug entre autre.

    Donc, ben si vous avez une petite idée..
    Merci

    (editPar contre, le code fonctionne, c'est surtout histoire d'utiliser gdb

  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 : 54
    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
    Il y a quoi à la ligne 51 de calculatrice.c?

  3. #3
    Membre confirmé Avatar de Gamall
    Profil pro
    Étudiant ENSEA
    Inscrit en
    Août 2009
    Messages
    252
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant ENSEA

    Informations forums :
    Inscription : Août 2009
    Messages : 252
    Par défaut
    ben, il n'y a rien de special:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    gtk_builder_get_object (pBuilder, "window1");
    c'était juste histoire de placer un breakpoint, mai meme si j'en met pas, j'ai toujours cette erreur

    sinon, pour info, j'utilise Mandriva, mais je ne vois pas trop ce que ça pourrai changer

  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 : 54
    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
    Tu utilises les threads dans ton programme? Si oui as-tu initialisé correctement le module?

  5. #5
    Membre confirmé Avatar de Gamall
    Profil pro
    Étudiant ENSEA
    Inscrit en
    Août 2009
    Messages
    252
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant ENSEA

    Informations forums :
    Inscription : Août 2009
    Messages : 252
    Par défaut
    Non, je n'utilise pas de threads.
    Par contre, merci pour le lien, ça m'interesse

  6. #6
    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 : 54
    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
    Pourrais-tu nous montrer ton code. J'avoue ne plus trop savoir en l'état actuel des choses

  7. #7
    Membre confirmé Avatar de Gamall
    Profil pro
    Étudiant ENSEA
    Inscrit en
    Août 2009
    Messages
    252
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant ENSEA

    Informations forums :
    Inscription : Août 2009
    Messages : 252
    Par défaut
    Voici le code, désolé, il est un peu long

    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
    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
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    #include <stdlib.h>
    #include <gtk/gtk.h>
    #include <unistd.h>
    #include <errno.h>
    #include <sys/wait.h>
    #include <string.h>
     
    typedef struct _MainWindow
    {
      GtkWidget *pWindow;
      GtkWidget *pEntry;
      GtkWidget *pLabel;
    } MainWindow;
     
    void OnQuitter (GtkWidget * widget, gpointer data);
     
    void OnButton (GtkWidget * widget, gpointer data);
     
    void OnResultat (GtkWidget * widget, gpointer data);
     
    void OnEffacer(GtkWidget * widget, gpointer data);
     
    void OnDelete (GtkWidget * widget, gpointer data);
     
    void OnAbout (GtkWidget * widget, gpointer data);
     
     
    int
    main (int argc, char **argv)
    {
      GtkBuilder *pBuilder = NULL;
      GError *pErr = NULL;
      MainWindow *calculatrice = NULL;
     
      gtk_init (&argc, &argv);
      calculatrice = g_new (MainWindow, 1);
     
     
      /* Creation d'un nouveau GtkBuilder */
      pBuilder = gtk_builder_new ();
     
      if (pBuilder != NULL)
        {
          /* Chargement du fichier xml dans pBuilder */
          gtk_builder_add_from_file (pBuilder, "calculatrice.glade", &pErr);
     
          if (pErr == NULL)
        {
          /* Recuperation d'un pointeur sur la fenetre */
          calculatrice->pWindow = (GtkWidget *)
            gtk_builder_get_object (pBuilder, "window1");
     
          /* Recuperation d'un pointeur vers le GtkEntry */
          calculatrice->pEntry = (GtkWidget *)
            gtk_builder_get_object (pBuilder, "entry1");
     
          /* Connexion des signaux */
          gtk_builder_connect_signals (pBuilder, (gpointer) calculatrice);
     
     
          gtk_widget_show_all (calculatrice->pWindow);
          gtk_main ();
        }
          else
        {
          /* Affichage du message d'erreur de Gtk+ */
          g_error ("%s", pErr->message);
          g_error_free (pErr);
        }
        }
     
     
      return EXIT_SUCCESS;
    }
     
     
    void
    OnButton (GtkWidget * widget, gpointer data)
    {
      const gchar *sEntry = NULL;
     
      /* Recuperation du calcul en cours dans la chaine sEntry */
      sEntry = gtk_entry_get_text (GTK_ENTRY (((MainWindow *) data)->pEntry));
     
      /* Cocatenation du de sEntry, avec le label du bouton */
      sEntry = g_strdup_printf ("%s%s",
                    sEntry,
                    gtk_button_get_label (GTK_BUTTON (widget)));
     
      /* Mise a jour du GtkEntry */
      gtk_entry_set_text (GTK_ENTRY (((MainWindow *) data)->pEntry), sEntry);
     
     
    }
     
    void
    OnResultat (GtkWidget * widget, gpointer data)
    {
      FILE *f_Calcul = NULL;
      FILE *f_History = NULL;
      gchar sResultat[100] = "";
     
      /* Appel du programme Calc.bin */
      if ((f_Calcul = (FILE *) popen ("./Calc.bin", "w")) == NULL)
        {
          /* En cas d'erreur */
          fprintf (stderr, "\n\tErreur popen %d\n", errno);
          exit (2);
        }
      /* Envoi de l'expression à Calc.bin */
      fprintf (f_Calcul, "%s\n",
           gtk_entry_get_text (GTK_ENTRY (((MainWindow *) data)->pEntry)));
     
      /* Fermeture du programme Calc.bin */
      pclose (f_Calcul);
     
      /* Recuperation du resultat dans l'historique de Calc.bin */
      if ((f_History = fopen ("history.txt", "r")) == NULL)
        {
          /* En cas d'erreur */
          fprintf (stderr,
               "\t\nErreur, Impossible d'ouvrir le fichier \"history.txt\"\n");
          exit (3);
        }
     
      /* Parcours de l'historique jusqu'au dernier resultat */
      while (fgets (sResultat, 100, f_History) != NULL);
     
      /* On suprime le '\n', à la fin du resultat */
      sResultat[strlen (sResultat) - 1] = '\0';
     
      /* Fermeture de l'historique */
      fclose (f_History);
     
      /* Affichage du resultat contenu dans sResultat, à partir
       * du caractere '>', dans le GtkEntry
       */
      gtk_entry_set_text (GTK_ENTRY (((MainWindow *) data)->pEntry),
                  sResultat + sizeof (gchar));
    }
     
    void
    OnDelete(GtkWidget * widget, gpointer data)
    {
     
    }
     
    void
    OnEffacer(GtkWidget * widget, gpointer data)
    {
        gtk_entry_set_text(GTK_ENTRY(((MainWindow*) data)->pEntry), "");
    }
     
    void
    OnAbout (GtkWidget * widget, gpointer data)
    {
      GtkWidget *pMessage = NULL;
     
      pMessage =
        gtk_message_dialog_new (GTK_WINDOW ((((MainWindow *) data)->pWindow)),
                    GTK_DIALOG_MODAL, GTK_MESSAGE_INFO,
                    GTK_BUTTONS_OK, "BisonCalc-v0.2");
     
      gtk_widget_show_all (pMessage);
      gtk_dialog_run (GTK_DIALOG (pMessage));
      gtk_widget_destroy (pMessage);
    }
     
    void
    OnQuitter (GtkWidget * widget, gpointer data)
    {
      g_free ((void *) data);
      gtk_main_quit ();
    }
    et voici le fichier glade:

    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
    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
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
    440
    441
    442
    443
    444
    445
    446
    447
    448
    449
    450
    451
    452
    453
    454
    455
    456
    457
    458
    459
    460
    461
    462
    463
    464
    465
    466
    467
    468
    469
    470
    471
    472
    473
    474
    475
    476
    477
    478
    479
    480
    481
    482
    483
    484
    485
    486
    487
    488
    489
    490
    491
    492
    493
    494
    495
    496
    497
    498
    499
    500
    501
    502
    503
    504
    505
    506
    507
    508
    509
    510
    511
    512
    513
    514
    515
    516
    517
    518
    519
    520
    521
    522
    523
    524
    525
    526
    527
    528
    529
    530
    531
    532
    533
    534
    535
    536
    537
    538
    539
    540
    541
    542
    543
    544
    545
    546
    547
    548
    549
    550
    551
    552
    553
    554
    555
    556
    557
    558
    559
    560
    561
    562
    563
    564
    565
    566
    567
    568
    569
    570
    571
    572
    573
    574
    575
    576
    577
    578
    579
    580
    581
    582
    583
    584
    585
    586
    587
    588
    589
    590
    591
    592
    593
    594
    595
    596
    597
    598
    599
    600
    601
    602
    603
    604
    605
    606
    607
    608
    609
    610
    611
    612
    613
    614
    615
    616
    617
    618
    619
    620
    621
    622
    623
    624
    625
    626
    627
    628
    629
    630
    631
    632
    633
    634
    635
    636
    637
    638
    639
    640
    641
    642
    643
    644
    645
    646
    647
    648
    649
    650
    651
    652
    653
    654
    655
    656
    657
    658
    659
    660
    661
    662
    663
    664
    665
    666
    667
    668
    669
    670
    671
    672
    673
    674
    675
    <?xml version="1.0"?>
    <interface>
      <requires lib="gtk+" version="2.16"/>
      <!-- interface-naming-policy project-wide -->
      <object class="GtkWindow" id="window1">
        <property name="border_width">5</property>
        <signal name="destroy" handler="OnQuitter"/>
        <child>
          <object class="GtkTable" id="table1">
            <property name="visible">True</property>
            <property name="n_rows">10</property>
            <property name="n_columns">11</property>
            <child>
              <object class="GtkEntry" id="entry1">
                <property name="visible">True</property>
                <property name="can_focus">True</property>
                <property name="invisible_char">&#x25CF;</property>
              </object>
              <packing>
                <property name="right_attach">10</property>
                <property name="top_attach">2</property>
                <property name="bottom_attach">3</property>
              </packing>
            </child>
            <child>
              <object class="GtkFrame" id="frame1">
                <property name="visible">True</property>
                <property name="label_xalign">0</property>
                <property name="shadow_type">none</property>
                <child>
                  <object class="GtkAlignment" id="alignment1">
                    <property name="visible">True</property>
                    <property name="left_padding">12</property>
                    <child>
                      <object class="GtkTable" id="table2">
                        <property name="visible">True</property>
                        <property name="n_rows">4</property>
                        <property name="n_columns">5</property>
                        <child>
                          <object class="GtkButton" id="chiffre7">
                            <property name="label" translatable="yes">7</property>
                            <property name="visible">True</property>
                            <property name="can_focus">True</property>
                            <property name="receives_default">True</property>
                            <signal name="clicked" handler="OnButton"/>
                          </object>
                        </child>
                        <child>
                          <object class="GtkButton" id="chiffre8">
                            <property name="label" translatable="yes">8</property>
                            <property name="visible">True</property>
                            <property name="can_focus">True</property>
                            <property name="receives_default">True</property>
                            <signal name="clicked" handler="OnButton"/>
                          </object>
                          <packing>
                            <property name="left_attach">1</property>
                            <property name="right_attach">2</property>
                          </packing>
                        </child>
                        <child>
                          <object class="GtkButton" id="chiffre9">
                            <property name="label" translatable="yes">9</property>
                            <property name="visible">True</property>
                            <property name="can_focus">True</property>
                            <property name="receives_default">True</property>
                            <signal name="clicked" handler="OnButton"/>
                          </object>
                          <packing>
                            <property name="left_attach">2</property>
                            <property name="right_attach">3</property>
                          </packing>
                        </child>
                        <child>
                          <object class="GtkButton" id="button4">
                            <property name="label" translatable="yes">/</property>
                            <property name="visible">True</property>
                            <property name="can_focus">True</property>
                            <property name="receives_default">True</property>
                            <signal name="clicked" handler="OnButton"/>
                          </object>
                          <packing>
                            <property name="left_attach">3</property>
                            <property name="right_attach">4</property>
                          </packing>
                        </child>
                        <child>
                          <object class="GtkButton" id="chiffre4">
                            <property name="label" translatable="yes">4</property>
                            <property name="visible">True</property>
                            <property name="can_focus">True</property>
                            <property name="receives_default">True</property>
                            <signal name="clicked" handler="OnButton"/>
                          </object>
                          <packing>
                            <property name="top_attach">1</property>
                            <property name="bottom_attach">2</property>
                          </packing>
                        </child>
                        <child>
                          <object class="GtkButton" id="chiffre5">
                            <property name="label" translatable="yes">5</property>
                            <property name="visible">True</property>
                            <property name="can_focus">True</property>
                            <property name="receives_default">True</property>
                            <signal name="clicked" handler="OnButton"/>
                          </object>
                          <packing>
                            <property name="left_attach">1</property>
                            <property name="right_attach">2</property>
                            <property name="top_attach">1</property>
                            <property name="bottom_attach">2</property>
                          </packing>
                        </child>
                        <child>
                          <object class="GtkButton" id="chiffre6">
                            <property name="label" translatable="yes">6</property>
                            <property name="visible">True</property>
                            <property name="can_focus">True</property>
                            <property name="receives_default">True</property>
                            <signal name="clicked" handler="OnButton"/>
                          </object>
                          <packing>
                            <property name="left_attach">2</property>
                            <property name="right_attach">3</property>
                            <property name="top_attach">1</property>
                            <property name="bottom_attach">2</property>
                          </packing>
                        </child>
                        <child>
                          <object class="GtkButton" id="button8">
                            <property name="label" translatable="yes">-</property>
                            <property name="visible">True</property>
                            <property name="can_focus">True</property>
                            <property name="receives_default">True</property>
                            <signal name="clicked" handler="OnButton"/>
                          </object>
                          <packing>
                            <property name="left_attach">3</property>
                            <property name="right_attach">4</property>
                            <property name="top_attach">1</property>
                            <property name="bottom_attach">2</property>
                          </packing>
                        </child>
                        <child>
                          <object class="GtkButton" id="chiffre1">
                            <property name="label" translatable="yes">1</property>
                            <property name="visible">True</property>
                            <property name="can_focus">True</property>
                            <property name="receives_default">True</property>
                            <signal name="clicked" handler="OnButton"/>
                          </object>
                          <packing>
                            <property name="top_attach">2</property>
                            <property name="bottom_attach">3</property>
                          </packing>
                        </child>
                        <child>
                          <object class="GtkButton" id="chiffre2">
                            <property name="label" translatable="yes">2</property>
                            <property name="visible">True</property>
                            <property name="can_focus">True</property>
                            <property name="receives_default">True</property>
                            <signal name="clicked" handler="OnButton"/>
                          </object>
                          <packing>
                            <property name="left_attach">1</property>
                            <property name="right_attach">2</property>
                            <property name="top_attach">2</property>
                            <property name="bottom_attach">3</property>
                          </packing>
                        </child>
                        <child>
                          <object class="GtkButton" id="chiffre3">
                            <property name="label" translatable="yes">3</property>
                            <property name="visible">True</property>
                            <property name="can_focus">True</property>
                            <property name="receives_default">True</property>
                            <signal name="clicked" handler="OnButton"/>
                          </object>
                          <packing>
                            <property name="left_attach">2</property>
                            <property name="right_attach">3</property>
                            <property name="top_attach">2</property>
                            <property name="bottom_attach">3</property>
                          </packing>
                        </child>
                        <child>
                          <object class="GtkButton" id="button12">
                            <property name="label" translatable="yes">*</property>
                            <property name="visible">True</property>
                            <property name="can_focus">True</property>
                            <property name="receives_default">True</property>
                            <signal name="clicked" handler="OnButton"/>
                          </object>
                          <packing>
                            <property name="left_attach">3</property>
                            <property name="right_attach">4</property>
                            <property name="top_attach">2</property>
                            <property name="bottom_attach">3</property>
                          </packing>
                        </child>
                        <child>
                          <object class="GtkButton" id="chiffre0">
                            <property name="label" translatable="yes">0</property>
                            <property name="visible">True</property>
                            <property name="can_focus">True</property>
                            <property name="receives_default">True</property>
                            <signal name="clicked" handler="OnButton"/>
                          </object>
                          <packing>
                            <property name="top_attach">3</property>
                            <property name="bottom_attach">4</property>
                          </packing>
                        </child>
                        <child>
                          <object class="GtkButton" id="button14">
                            <property name="label" translatable="yes">.</property>
                            <property name="visible">True</property>
                            <property name="can_focus">True</property>
                            <property name="receives_default">True</property>
                            <signal name="clicked" handler="OnButton"/>
                          </object>
                          <packing>
                            <property name="left_attach">1</property>
                            <property name="right_attach">2</property>
                            <property name="top_attach">3</property>
                            <property name="bottom_attach">4</property>
                          </packing>
                        </child>
                        <child>
                          <object class="GtkButton" id="button16">
                            <property name="label" translatable="yes">+</property>
                            <property name="visible">True</property>
                            <property name="can_focus">True</property>
                            <property name="receives_default">True</property>
                            <signal name="clicked" handler="OnButton"/>
                          </object>
                          <packing>
                            <property name="left_attach">3</property>
                            <property name="right_attach">4</property>
                            <property name="top_attach">3</property>
                            <property name="bottom_attach">4</property>
                          </packing>
                        </child>
                        <child>
                          <object class="GtkButton" id="delete">
                            <property name="label" translatable="yes">&#x2190;</property>
                            <property name="visible">True</property>
                            <property name="can_focus">True</property>
                            <property name="receives_default">True</property>
                            <signal name="clicked" handler="OnDelete"/>
                          </object>
                          <packing>
                            <property name="left_attach">2</property>
                            <property name="right_attach">3</property>
                            <property name="top_attach">3</property>
                            <property name="bottom_attach">4</property>
                          </packing>
                        </child>
                        <child>
                          <object class="GtkButton" id="egal">
                            <property name="label" translatable="yes">=</property>
                            <property name="visible">True</property>
                            <property name="can_focus">True</property>
                            <property name="receives_default">True</property>
                            <signal name="clicked" handler="OnResultat"/>
                          </object>
                          <packing>
                            <property name="left_attach">4</property>
                            <property name="right_attach">5</property>
                            <property name="top_attach">2</property>
                            <property name="bottom_attach">4</property>
                          </packing>
                        </child>
                        <child>
                          <object class="GtkButton" id="clear">
                            <property name="label" translatable="yes">CE</property>
                            <property name="visible">True</property>
                            <property name="can_focus">True</property>
                            <property name="receives_default">True</property>
                            <signal name="clicked" handler="OnEffacer"/>
                          </object>
                          <packing>
                            <property name="left_attach">4</property>
                            <property name="right_attach">5</property>
                            <property name="bottom_attach">2</property>
                          </packing>
                        </child>
                      </object>
                    </child>
                  </object>
                </child>
                <child type="label">
                  <object class="GtkLabel" id="label1">
                    <property name="visible">True</property>
                    <property name="xpad">11</property>
                    <property name="label" translatable="yes">&lt;b&gt;Basique&lt;/b&gt;</property>
                    <property name="use_markup">True</property>
                  </object>
                </child>
              </object>
              <packing>
                <property name="right_attach">7</property>
                <property name="top_attach">4</property>
                <property name="bottom_attach">10</property>
                <property name="x_options">GTK_FILL</property>
              </packing>
            </child>
            <child>
              <object class="GtkFrame" id="frame2">
                <property name="visible">True</property>
                <property name="label_xalign">0</property>
                <property name="shadow_type">none</property>
                <child>
                  <object class="GtkAlignment" id="alignment2">
                    <property name="visible">True</property>
                    <property name="left_padding">12</property>
                    <child>
                      <object class="GtkTable" id="table3">
                        <property name="visible">True</property>
                        <property name="n_rows">4</property>
                        <property name="n_columns">2</property>
                        <child>
                          <object class="GtkButton" id="button17">
                            <property name="label" translatable="yes">(</property>
                            <property name="visible">True</property>
                            <property name="can_focus">True</property>
                            <property name="receives_default">True</property>
                            <signal name="clicked" handler="OnButton"/>
                          </object>
                        </child>
                        <child>
                          <object class="GtkButton" id="button18">
                            <property name="label" translatable="yes">)</property>
                            <property name="visible">True</property>
                            <property name="can_focus">True</property>
                            <property name="receives_default">True</property>
                            <signal name="clicked" handler="OnButton"/>
                          </object>
                          <packing>
                            <property name="left_attach">1</property>
                            <property name="right_attach">2</property>
                          </packing>
                        </child>
                        <child>
                          <object class="GtkButton" id="button19">
                            <property name="label" translatable="yes">sin</property>
                            <property name="visible">True</property>
                            <property name="can_focus">True</property>
                            <property name="receives_default">True</property>
                          </object>
                          <packing>
                            <property name="top_attach">1</property>
                            <property name="bottom_attach">2</property>
                          </packing>
                        </child>
                        <child>
                          <object class="GtkButton" id="button20">
                            <property name="label" translatable="yes">cos</property>
                            <property name="visible">True</property>
                            <property name="can_focus">True</property>
                            <property name="receives_default">True</property>
                          </object>
                          <packing>
                            <property name="left_attach">1</property>
                            <property name="right_attach">2</property>
                            <property name="top_attach">1</property>
                            <property name="bottom_attach">2</property>
                          </packing>
                        </child>
                        <child>
                          <object class="GtkButton" id="button21">
                            <property name="label" translatable="yes">tan</property>
                            <property name="visible">True</property>
                            <property name="can_focus">True</property>
                            <property name="receives_default">True</property>
                          </object>
                          <packing>
                            <property name="top_attach">2</property>
                            <property name="bottom_attach">3</property>
                          </packing>
                        </child>
                        <child>
                          <object class="GtkButton" id="button22">
                            <property name="label" translatable="yes">x^y</property>
                            <property name="visible">True</property>
                            <property name="can_focus">True</property>
                            <property name="receives_default">True</property>
                          </object>
                          <packing>
                            <property name="left_attach">1</property>
                            <property name="right_attach">2</property>
                            <property name="top_attach">2</property>
                            <property name="bottom_attach">3</property>
                          </packing>
                        </child>
                        <child>
                          <object class="GtkButton" id="button23">
                            <property name="label" translatable="yes">pi</property>
                            <property name="visible">True</property>
                            <property name="can_focus">True</property>
                            <property name="receives_default">True</property>
                          </object>
                          <packing>
                            <property name="top_attach">3</property>
                            <property name="bottom_attach">4</property>
                          </packing>
                        </child>
                        <child>
                          <object class="GtkButton" id="button24">
                            <property name="label" translatable="yes">log</property>
                            <property name="visible">True</property>
                            <property name="can_focus">True</property>
                            <property name="receives_default">True</property>
                          </object>
                          <packing>
                            <property name="left_attach">1</property>
                            <property name="right_attach">2</property>
                            <property name="top_attach">3</property>
                            <property name="bottom_attach">4</property>
                          </packing>
                        </child>
                      </object>
                    </child>
                  </object>
                </child>
                <child type="label">
                  <object class="GtkLabel" id="label2">
                    <property name="visible">True</property>
                    <property name="xpad">10</property>
                    <property name="label" translatable="yes">&lt;b&gt;Scientifique&lt;/b&gt;</property>
                    <property name="use_markup">True</property>
                  </object>
                </child>
              </object>
              <packing>
                <property name="left_attach">8</property>
                <property name="right_attach">11</property>
                <property name="top_attach">4</property>
                <property name="bottom_attach">10</property>
              </packing>
            </child>
            <child>
              <object class="GtkMenuBar" id="menubar1">
                <property name="visible">True</property>
                <child>
                  <object class="GtkMenuItem" id="menuitem1">
                    <property name="visible">True</property>
                    <property name="label" translatable="yes">_Fichier</property>
                    <property name="use_underline">True</property>
                    <child type="submenu">
                      <object class="GtkMenu" id="menu1">
                        <property name="visible">True</property>
                        <child>
                          <object class="GtkImageMenuItem" id="imagemenuitem1">
                            <property name="label">gtk-new</property>
                            <property name="visible">True</property>
                            <property name="use_underline">True</property>
                            <property name="use_stock">True</property>
                          </object>
                        </child>
                        <child>
                          <object class="GtkImageMenuItem" id="imagemenuitem2">
                            <property name="label">gtk-open</property>
                            <property name="visible">True</property>
                            <property name="use_underline">True</property>
                            <property name="use_stock">True</property>
                          </object>
                        </child>
                        <child>
                          <object class="GtkImageMenuItem" id="imagemenuitem3">
                            <property name="label">gtk-save</property>
                            <property name="visible">True</property>
                            <property name="use_underline">True</property>
                            <property name="use_stock">True</property>
                          </object>
                        </child>
                        <child>
                          <object class="GtkImageMenuItem" id="imagemenuitem4">
                            <property name="label">gtk-save-as</property>
                            <property name="visible">True</property>
                            <property name="use_underline">True</property>
                            <property name="use_stock">True</property>
                          </object>
                        </child>
                        <child>
                          <object class="GtkSeparatorMenuItem" id="separatormenuitem1">
                            <property name="visible">True</property>
                          </object>
                        </child>
                        <child>
                          <object class="GtkImageMenuItem" id="imagemenuitem5">
                            <property name="label">gtk-quit</property>
                            <property name="visible">True</property>
                            <property name="use_underline">True</property>
                            <property name="use_stock">True</property>
                            <signal name="activate" handler="OnQuitter"/>
                          </object>
                        </child>
                      </object>
                    </child>
                  </object>
                </child>
                <child>
                  <object class="GtkMenuItem" id="menuitem2">
                    <property name="visible">True</property>
                    <property name="label" translatable="yes">&#xC9;_dition</property>
                    <property name="use_underline">True</property>
                    <child type="submenu">
                      <object class="GtkMenu" id="menu2">
                        <property name="visible">True</property>
                        <child>
                          <object class="GtkImageMenuItem" id="imagemenuitem6">
                            <property name="label">gtk-cut</property>
                            <property name="visible">True</property>
                            <property name="use_underline">True</property>
                            <property name="use_stock">True</property>
                          </object>
                        </child>
                        <child>
                          <object class="GtkImageMenuItem" id="imagemenuitem7">
                            <property name="label">gtk-copy</property>
                            <property name="visible">True</property>
                            <property name="use_underline">True</property>
                            <property name="use_stock">True</property>
                          </object>
                        </child>
                        <child>
                          <object class="GtkImageMenuItem" id="imagemenuitem8">
                            <property name="label">gtk-paste</property>
                            <property name="visible">True</property>
                            <property name="use_underline">True</property>
                            <property name="use_stock">True</property>
                          </object>
                        </child>
                        <child>
                          <object class="GtkImageMenuItem" id="imagemenuitem9">
                            <property name="label">gtk-delete</property>
                            <property name="visible">True</property>
                            <property name="use_underline">True</property>
                            <property name="use_stock">True</property>
                          </object>
                        </child>
                      </object>
                    </child>
                  </object>
                </child>
                <child>
                  <object class="GtkMenuItem" id="menuitem3">
                    <property name="visible">True</property>
                    <property name="label" translatable="yes">_Affichage</property>
                    <property name="use_underline">True</property>
                  </object>
                </child>
                <child>
                  <object class="GtkMenuItem" id="menuitem4">
                    <property name="visible">True</property>
                    <property name="label" translatable="yes">Aid_e</property>
                    <property name="use_underline">True</property>
                    <child type="submenu">
                      <object class="GtkMenu" id="menu3">
                        <property name="visible">True</property>
                        <child>
                          <object class="GtkImageMenuItem" id="imagemenuitem10">
                            <property name="label">gtk-about</property>
                            <property name="visible">True</property>
                            <property name="use_underline">True</property>
                            <property name="use_stock">True</property>
                            <signal name="activate" handler="OnAbout"/>
                          </object>
                        </child>
                      </object>
                    </child>
                  </object>
                </child>
              </object>
              <packing>
                <property name="right_attach">10</property>
              </packing>
            </child>
            <child>
              <placeholder/>
            </child>
            <child>
              <placeholder/>
            </child>
            <child>
              <placeholder/>
            </child>
            <child>
              <placeholder/>
            </child>
            <child>
              <placeholder/>
            </child>
            <child>
              <placeholder/>
            </child>
            <child>
              <placeholder/>
            </child>
            <child>
              <placeholder/>
            </child>
            <child>
              <placeholder/>
            </child>
            <child>
              <placeholder/>
            </child>
            <child>
              <placeholder/>
            </child>
            <child>
              <placeholder/>
            </child>
            <child>
              <placeholder/>
            </child>
            <child>
              <placeholder/>
            </child>
            <child>
              <placeholder/>
            </child>
            <child>
              <placeholder/>
            </child>
            <child>
              <placeholder/>
            </child>
            <child>
              <placeholder/>
            </child>
            <child>
              <placeholder/>
            </child>
            <child>
              <placeholder/>
            </child>
            <child>
              <placeholder/>
            </child>
            <child>
              <placeholder/>
            </child>
            <child>
              <placeholder/>
            </child>
            <child>
              <placeholder/>
            </child>
            <child>
              <placeholder/>
            </child>
            <child>
              <placeholder/>
            </child>
            <child>
              <placeholder/>
            </child>
            <child>
              <placeholder/>
            </child>
            <child>
              <placeholder/>
            </child>
            <child>
              <placeholder/>
            </child>
          </object>
        </child>
      </object>
    </interface>

  8. #8
    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 : 54
    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
    J'ai repris ton code en modifiant seulement les déclarations des différents callback pour respecter la norme indiquée par la documentation. Ca compile et s'éxécute sans aucun problème chez moi:
    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
    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
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    #include <stdlib.h>
    #include <gtk/gtk.h>
    #include <unistd.h>
    #include <errno.h>
    #include <sys/wait.h>
    #include <string.h>
     
    typedef struct _MainWindow
    {
      GtkWidget *pWindow;
      GtkWidget *pEntry;
      GtkWidget *pLabel;
    } MainWindow;
     
    void OnQuitter (GtkObject *object, gpointer data);
     
    void OnButton (GtkButton *button, gpointer data);
     
    void OnResultat (GtkButton *button, gpointer data);
     
    void OnEffacer(GtkButton *button, gpointer data);
     
    void OnDelete (GtkButton *button, gpointer data);
     
    void OnAbout (GtkMenuItem *menuitem, gpointer data);
     
     
    int
    main (int argc, char **argv)
    {
      GtkBuilder *pBuilder = NULL;
      GError *pErr = NULL;
      MainWindow *calculatrice = NULL;
     
      gtk_init (&argc, &argv);
      calculatrice = g_new (MainWindow, 1);
     
     
      /* Creation d'un nouveau GtkBuilder */
      pBuilder = gtk_builder_new ();
     
      if (pBuilder != NULL)
        {
          /* Chargement du fichier xml dans pBuilder */
          gtk_builder_add_from_file (pBuilder, "calculatrice.glade", &pErr);
     
          if (pErr == NULL)
        {
          /* Recuperation d'un pointeur sur la fenetre */
          calculatrice->pWindow = (GtkWidget *)
            gtk_builder_get_object (pBuilder, "window1");
     
          /* Recuperation d'un pointeur vers le GtkEntry */
          calculatrice->pEntry = (GtkWidget *)
            gtk_builder_get_object (pBuilder, "entry1");
     
          /* Connexion des signaux */
          gtk_builder_connect_signals (pBuilder, calculatrice);
     
     
          gtk_widget_show_all (calculatrice->pWindow);
          gtk_main ();
        }
          else
        {
          /* Affichage du message d'erreur de Gtk+ */
          g_error ("%s", pErr->message);
          g_error_free (pErr);
        }
        }
     
     
      return EXIT_SUCCESS;
    }
     
     
    void
    OnButton (GtkButton *button, gpointer data)
    {
      const gchar *sEntry = NULL;
     
      /* Recuperation du calcul en cours dans la chaine sEntry */
      sEntry = gtk_entry_get_text (GTK_ENTRY (((MainWindow *) data)->pEntry));
     
      /* Cocatenation du de sEntry, avec le label du bouton */
      sEntry = g_strdup_printf ("%s%s",
                    sEntry,
                    gtk_button_get_label (button));
     
      /* Mise a jour du GtkEntry */
      gtk_entry_set_text (GTK_ENTRY (((MainWindow *) data)->pEntry), sEntry);
     
     
    }
     
    void
    OnResultat (GtkButton *button, gpointer data)
    {
      FILE *f_Calcul = NULL;
      FILE *f_History = NULL;
      gchar sResultat[100] = "";
     
      /* Appel du programme Calc.bin */
      if ((f_Calcul = (FILE *) popen ("./Calc.bin", "w")) == NULL)
        {
          /* En cas d'erreur */
          fprintf (stderr, "\n\tErreur popen %d\n", errno);
          exit (2);
        }
      /* Envoi de l'expression à Calc.bin */
      fprintf (f_Calcul, "%s\n",
           gtk_entry_get_text (GTK_ENTRY (((MainWindow *) data)->pEntry)));
     
      /* Fermeture du programme Calc.bin */
      pclose (f_Calcul);
     
      /* Recuperation du resultat dans l'historique de Calc.bin */
      if ((f_History = fopen ("history.txt", "r")) == NULL)
        {
          /* En cas d'erreur */
          fprintf (stderr,
               "\t\nErreur, Impossible d'ouvrir le fichier \"history.txt\"\n");
          exit (3);
        }
     
      /* Parcours de l'historique jusqu'au dernier resultat */
      while (fgets (sResultat, 100, f_History) != NULL);
     
      /* On suprime le '\n', à la fin du resultat */
      sResultat[strlen (sResultat) - 1] = '\0';
     
      /* Fermeture de l'historique */
      fclose (f_History);
     
      /* Affichage du resultat contenu dans sResultat, à partir
       * du caractere '>', dans le GtkEntry
       */
      gtk_entry_set_text (GTK_ENTRY (((MainWindow *) data)->pEntry),
                  sResultat + sizeof (gchar));
    }
     
    void
    OnDelete(GtkButton *button, gpointer data)
    {
     
    }
     
    void
    OnEffacer(GtkButton *button, gpointer data)
    {
        gtk_entry_set_text(GTK_ENTRY(((MainWindow*) data)->pEntry), "");
    }
     
    void
    OnAbout (GtkMenuItem *menuitem, gpointer data)
    {
      GtkWidget *pMessage = NULL;
     
      pMessage =
        gtk_message_dialog_new (GTK_WINDOW ((((MainWindow *) data)->pWindow)),
                    GTK_DIALOG_MODAL, GTK_MESSAGE_INFO,
                    GTK_BUTTONS_OK, "BisonCalc-v0.2");
     
      gtk_widget_show_all (pMessage);
      gtk_dialog_run (GTK_DIALOG (pMessage));
      gtk_widget_destroy (pMessage);
    }
     
    void
    OnQuitter (GtkObject *object, gpointer data)
    {
      g_free ((void *) data);
      gtk_main_quit ();
    }
    Bien sûr pour pouvoir utiliser l'affectation des signaux de GtkBuilder il faut aussi ajouter la librairie "gmodule_export" :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    pkg-config gmodule-export-2.0 --cflags --libs

  9. #9
    Membre confirmé Avatar de Gamall
    Profil pro
    Étudiant ENSEA
    Inscrit en
    Août 2009
    Messages
    252
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant ENSEA

    Informations forums :
    Inscription : Août 2009
    Messages : 252
    Par défaut
    Non, ça marche toujours pas

    Je compilais avec cette ligne de commande:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    gcc -o calculatrice calculatrice.c $(pkg-config --cflags --libs gtk+-2.0 gmodule-2.0) --ansi -pedantic -W -g
    et j'ai essayé avec celle là:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    gcc -o calculatrice calculatrice.c $(pkg-config --cflags --libs gtk+-2.0 gmodule-export-2.0) --ansi -pedantic -W -g
    ça n'a rien changé

    [EDIT] Apparement, le message d'erreur apparait quand on arrive après la ligne
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    gtk_init(&argc, &argv);
    Je m'en suis rendu compte en plaçant un breakpoint à la 1ere ligne puis en avançant avec "next"

  10. #10
    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 : 54
    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
    ma ligne de commande :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    gcc -Wunused -g -Wall  `pkg-config gtk+-2.0 --cflags --libs`     `pkg-config gmodule-export-2.0 --cflags --libs` main.c -o essai
    Mais ca ne change pas grand chose je pense. Tu dois surement avoir un problème d'installation des bibliothèques de développement.

  11. #11
    Membre confirmé Avatar de Gamall
    Profil pro
    Étudiant ENSEA
    Inscrit en
    Août 2009
    Messages
    252
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant ENSEA

    Informations forums :
    Inscription : Août 2009
    Messages : 252
    Par défaut
    Mouais, effectivement, ça ne change pas grand chose

    Mais ce qui est curieux, c'est que quand j'utilisais codeblocks, je pouvais debugger une application gtk, sans que tous les packages debug soient installés.
    Et je n'avais pas de message d'erreur.

    Mais j'ai arreté de l'utiliser, pour ces raisons:
    - ça me faisait des plantages, notamment avec la touche altgr qui ne fonctionnait plus du tout sous linux, il fallait que je redemarre
    - Probleme de compatibilité des fichiers ".c" avec vim: je me retrouvais avec des caracteres bizares un peu partout dans le code
    -Pas moyen de faire tourner une application qui utilise un fichier glade, j'arrivais pas à connecter les signaux, et ça faisait des warnings
    Pour m'habituer aux makefiles, et à la compilation en console.

    D'ailleurs, je trouve que finalement, on va beaucoup plus vite avec vim

    Mais bon, je me demande vraiment pourquoi codeblocks arrive à debugger, et que en ligne de commande ça marche pas

  12. #12
    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 : 54
    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
    voila un copier/coller de gdb en mode console avec ton programme:
    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
    gdb essai
    GNU gdb 6.8-debian
    Copyright (C) 2008 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
    and "show warranty" for details.
    This GDB was configured as "x86_64-linux-gnu"...
    (gdb) start
    Breakpoint 1 at 0x40150b: file main.c, line 31.
    Starting program: /home/moi/essai 
    [Thread debugging using libthread_db enabled]
    [New Thread 0x7f36a676f780 (LWP 22776)]
    [Switching to Thread 0x7f36a676f780 (LWP 22776)]
    main (argc=1, argv=0x7fffb69f1038) at main.c:31
    31	  GtkBuilder *pBuilder = NULL;
    (gdb) next
    32	  GError *pErr = NULL;
    (gdb) next
    33	  MainWindow *calculatrice = NULL;
    (gdb) next
    35	  gtk_init (&argc, &argv);
    (gdb) next
    36	  calculatrice = g_new (MainWindow, 1);
    (gdb) next
    40	  pBuilder = gtk_builder_new ();
    (gdb) next
    42	  if (pBuilder != NULL)
    (gdb)
    Je ne rencontre aucun problème. Ca ne vient donc pas du code mais bien des librairies.

  13. #13
    Membre confirmé Avatar de Gamall
    Profil pro
    Étudiant ENSEA
    Inscrit en
    Août 2009
    Messages
    252
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant ENSEA

    Informations forums :
    Inscription : Août 2009
    Messages : 252
    Par défaut
    Oui, moi, ça plante à la ligne 36

    ça doit venir de Mandriva, il me manque peut etre des librairy...

    Sinon, je peux essayer de compiler une autre version de gdb...

  14. #14
    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 : 54
    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
    La version de gdb que j'utilise au cas où :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    GNU gdb 6.8-debian
    Copyright (C) 2008 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
    and "show warranty" for details.
    This GDB was configured as "x86_64-linux-gnu".

  15. #15
    Membre confirmé Avatar de Gamall
    Profil pro
    Étudiant ENSEA
    Inscrit en
    Août 2009
    Messages
    252
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant ENSEA

    Informations forums :
    Inscription : Août 2009
    Messages : 252
    Par défaut
    j'ai compilé gdb-7.0, j'ai toujours le probleme

    par contre, j'ai trouvé ça en cherchant: http://www.mail-archive.com/gtk-list.../msg27762.html
    Mais par contre le probleme n'a pas été resolu

    Sinon, ben tant pis, j'utiliserai la bonne vieille methode du printf

  16. #16
    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 : 54
    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
    Effectivement il semblerait que gdb arrête momentanément l'application. Il suffirait simplement de dire de continuer pour passer outre le problème!

    Étrange d'autant plus que je ne rencontre pas le problème chez moi avec le même code que toi.

  17. #17
    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
    Ah oui, j'ai le même souci avec le gdb de ma mandriva. Bizarre... Mais effectivement, il suffit de faire "c" quand gdb s'arrête la première fois et ensuite tu peux débugger normalement. Je sais pas ce que fait ton programme, mais j'avais jamais rencontré ce problème jusqu'ici

  18. #18
    Membre confirmé Avatar de Gamall
    Profil pro
    Étudiant ENSEA
    Inscrit en
    Août 2009
    Messages
    252
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant ENSEA

    Informations forums :
    Inscription : Août 2009
    Messages : 252
    Par défaut
    J'ai essayé "c", ça marche toujours pas

  19. #19
    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 : 54
    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
    De mon côté j'utilise un débogueur plus puissant que gdb, enfin je trouve. Ce débogueur s'intègre directement au code source.
    Bon ok, ca ne fait pas avancer le chmilblik.

  20. #20
    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
    Il se passe quoi quand tu fais "c" ? (sans les guillemets hein)

+ Répondre à la discussion
Cette discussion est résolue.
Page 1 sur 2 12 DernièreDernière

Discussions similaires

  1. Développez et déployez une application GTK+ sous Windows
    Par gege2061 dans le forum Contribuez
    Réponses: 5
    Dernier message: 22/02/2018, 15h49
  2. Enlever la console d'une application GTK+
    Par laflaf3d dans le forum GTK+ avec C & C++
    Réponses: 1
    Dernier message: 09/06/2009, 00h30
  3. [ PERDU ] Portage d'une application GTK+
    Par R3cKa dans le forum GTK+ avec C & C++
    Réponses: 7
    Dernier message: 01/02/2009, 17h28
  4. Réponses: 1
    Dernier message: 29/06/2007, 02h26

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