Partage
  • Partager sur Facebook
  • Partager sur Twitter

Probleme de compilation avec gcc sous osx

je débute soyez indulgent avec moi!...snif

    25 janvier 2006 à 13:53:16

    voilà j'ai codé en (c)un programme tout bête :
    j'ai trois fichier main.c afficher.c afficher.h

    lorsque je compile gcc me dis:

    main.c: In function `afficher':
    main.c:6: warning: `main' is usually a function
    main.c:6: error: parse error before '{' token
    main.c:6: error: declaration for parameter `main' but no such parameter
    main.c:8: error: number of arguments doesn't match prototype
    cc1: error: prototype declaration
    afficher.c: In function `afficher':
    afficher.c:6: error: parse error before '{' token
    afficher.c:6: error: declaration for parameter `afficher' but no such parameter
    afficher.c:8: error: number of arguments doesn't match prototype
    cc1: error: prototype declaration

    voici mon fichier main.c:

    #include<stdlib.h>
    #include"afficher.h"


    int main()
    {
    afficher();
    return EXIT_SUCCES;
    }

    mon fichier afficher.c:

    #include<stdio.h>
    #include"afficher.h"

    void
    afficher(void)
    {
    printf("printf peut afficher ceci:\n");
    printf("hoo yeah!\n");
    }

    mon fichier afficher.h:#ifndef AFFICHER_H
    #define AFFICHER_H

    extern void afficher(void)

    #endif AFFICHER_H /*AFFICHER_H*/

    voilà je sui un peu perdu et j'ai cherché des réponse sur divers forum sans résultat.
    merci de m'aider(en espérant avoir bien rédigé ma question) à bientôt


    • Partager sur Facebook
    • Partager sur Twitter
      26 janvier 2006 à 21:29:06

      #include<stdio.h>

      void afficher(void)
      {
      printf("printf peut afficher ceci:\n");
      printf("hoo yeah!\n");
      }

      int main()
      {
      afficher();

      system("PAUSE");
      return 0;

      }
      • Partager sur Facebook
      • Partager sur Twitter
      Anonyme
        26 janvier 2006 à 21:33:48

        Et surtout : tu as oublié le ; à la fin du prototype dans le .h et comme il est inclut ça empêche la compilation.
        • Partager sur Facebook
        • Partager sur Twitter

        Probleme de compilation avec gcc sous osx

        × Après avoir cliqué sur "Répondre" vous serez invité à vous connecter pour que votre message soit publié.
        × Attention, ce sujet est très ancien. Le déterrer n'est pas forcément approprié. Nous te conseillons de créer un nouveau sujet pour poser ta question.
        • Editeur
        • Markdown