Partage
  • Partager sur Facebook
  • Partager sur Twitter

Grosse erreur de compilation C CodeBlocks

Sujet résolu
    8 avril 2021 à 15:57:49

    La dernière fois que j'ai travailler dessus, je n'avais aucunes erreurs. J'ai fait quelques modifications aujourd'hui et j'ai cette grosse erreur qui est arrivée je ne sais trop pourquoi. J'ai essayé de chercher mais je ne comprends pas d'où elle peut venir.
    ||=== Build: Debug in CornetClement2123ProvisionsP2 (compiler: GNU GCC Compiler) ===|
    G:\HEPL\laboC\Q2\CornetClement2123ProvisionsP2\CornetClement2123ProvisionsP2.c||In function 'InsertFourni':|
    G:\HEPL\laboC\Q2\CornetClement2123ProvisionsP2\CornetClement2123ProvisionsP2.c|57|error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token|
    G:\HEPL\laboC\Q2\CornetClement2123ProvisionsP2\CornetClement2123ProvisionsP2.c|91|error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token|
    G:\HEPL\laboC\Q2\CornetClement2123ProvisionsP2\CornetClement2123ProvisionsP2.c|132|error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token|
    G:\HEPL\laboC\Q2\CornetClement2123ProvisionsP2\CornetClement2123ProvisionsP2.c|159|error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token|
    G:\HEPL\laboC\Q2\CornetClement2123ProvisionsP2\CornetClement2123ProvisionsP2.c|200|error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token|
    G:\HEPL\laboC\Q2\CornetClement2123ProvisionsP2\CornetClement2123ProvisionsP2.c|207|error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token|
    G:\HEPL\laboC\Q2\CornetClement2123ProvisionsP2\CornetClement2123ProvisionsP2.c|211|error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token|
    G:\HEPL\laboC\Q2\CornetClement2123ProvisionsP2\CornetClement2123ProvisionsP2.c|215|error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token|
    G:\HEPL\laboC\Q2\CornetClement2123ProvisionsP2\CornetClement2123ProvisionsP2.c|220|error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token|
    G:\HEPL\laboC\Q2\CornetClement2123ProvisionsP2\CornetClement2123ProvisionsP2.c|236|error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token|
    G:\HEPL\laboC\Q2\CornetClement2123ProvisionsP2\CornetClement2123ProvisionsP2.c|268|error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token|
    G:\HEPL\laboC\Q2\CornetClement2123ProvisionsP2\CornetClement2123ProvisionsP2.c|278|error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token|
    G:\HEPL\laboC\Q2\CornetClement2123ProvisionsP2\CornetClement2123ProvisionsP2.c|313|error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token|
    G:\HEPL\laboC\Q2\CornetClement2123ProvisionsP2\CornetClement2123ProvisionsP2.c|341|error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token|
    G:\HEPL\laboC\Q2\CornetClement2123ProvisionsP2\CornetClement2123ProvisionsP2.c|371|error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token|
    G:\HEPL\laboC\Q2\CornetClement2123ProvisionsP2\CornetClement2123ProvisionsP2.c|378|error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token|
    G:\HEPL\laboC\Q2\CornetClement2123ProvisionsP2\CornetClement2123ProvisionsP2.c|382|error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token|
    G:\HEPL\laboC\Q2\CornetClement2123ProvisionsP2\CornetClement2123ProvisionsP2.c|387|error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token|
    G:\HEPL\laboC\Q2\CornetClement2123ProvisionsP2\CornetClement2123ProvisionsP2.c|393|error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token|
    G:\HEPL\laboC\Q2\CornetClement2123ProvisionsP2\CornetClement2123ProvisionsP2.c|399|error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token|
    G:\HEPL\laboC\Q2\CornetClement2123ProvisionsP2\CornetClement2123ProvisionsP2.c|41|error: old-style parameter declarations in prototyped function definition|
    G:\HEPL\laboC\Q2\CornetClement2123ProvisionsP2\CornetClement2123ProvisionsP2.c|415|error: expected '{' at end of input|
    ||=== Build failed: 22 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|
    
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <conio.h>
    
    struct produit{
        char idProd[14];
        char marque[50];
        char nomProd[50];
        char volume [8];
        char categorie [40];
        long psvt;
    };
    typedef struct produit PROD;
    char NomFicheProd[]= "produits.dat";
    PROD Prod;
    long PTL, PTO ;
    
    struct fournisseur{
        long idFourni;
        char nomFourni[50];
        char villeFourni[40];
    };
    typedef struct fournisseur FOURNI;
    char NomFicheFourni[]= "fournisseurs.dat";
    FOURNI Fourni;
    
    ////////FONCTIONS PRODUITS////////
    void CheckFicheProd(char* NomFicheProd, FILE* fp);
    void MenuProd(char* NomFicheProd);
    void AddProd(char* NomFicheProd, PROD* Prod);
    void InsertProd(char* NomFicheProd, PROD* Prod);
    void AffProdSeq(char* NomFicheProd);
    void AffProdTri(char* NomFicheProd);
    void ModifProd(char* NomFicheProd);
    
    ////////FONCTIONS FOURNISSEURS////////
    void CheckFicheFourni(char* NomFicheFourni);
    void MenuFourni(char* NomFicheFourni);
    void AddFourni(char* NomFicheFourni, FOURNI* Fourni);
    void InsertFourni(char* NomFicheFourni, FOURNI* Fourni)
    void AffFourniSeq(char* NomFicheFourni);
    void ModifFourni(char* NomFicheFourni);
    
    ////////FONCTIONS ENTREES////////
    void Saisie(char* chaine);
    
    ////////FONCTIONS CONTROLE ENTREES PRODUITS////////
    int CtrlIdProd(char* NomFicheProd, char* chaine);
    int CtrlTaille(char* chaine, int* taille);
    int CtrlVol(char* chaine);
    
    ////////FONCTIONS CONTROLE ENTREES FOURNISSEURS////////
    int CtrlIdFourni(char* chaine);
    int CtrlFourniDiff(char* NomFicheFourni, FOURNI* Fourni);
    
    int main(){
        int choix = 0;
    
        do{
            system("cls");
            printf("Application Provisions (Partie 2)\n");
            printf("°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°\n\n");
            printf("1. GERER les produits\n");
            printf("2. GERER les fournisseurs\n");
            printf("3. GERER les achats\n");
            printf("4. Quitter\n");
    
            printf("Votre choix : ");
            fflush(stdin);
            scanf("%d", &choix);
    
            switch(choix){
                case 1: MenuProd(&NomFicheProd[0]);
                        printf("Pressez une touche...");
                        getch();
                        break;
                case 2: MenuFourni(&NomFicheFourni[0]);
                        printf("Pressez une touche...");
                        getch();
                        break;
                case 3: printf("Fonctionalite pas encore ajoutee...");
                        getch();
                        break;
            }
        }while(choix != 4);
    }
    
    
    ////////FONCTIONS PRODUITS////////
    void MenuProd(char* NomFicheProd){
        int choix = 0;
        FILE *fp;
    
        CheckFicheProd(NomFicheProd, fp);
    
        do{
            system("cls");
            printf("Gestion des produits\n");
            printf("°°°°°°°°°°°°°°°°°°°°\n\n");
            printf("1. Ajout d'un produit\n");
            printf("2. Affichage sequentiel des produits\n");
            printf("3. Affichage des produits dans un ordre alphabetique sur CMN (cat/marque/nom)\n");
            printf("4. Modification d'un produit (Bonus)\n");
            printf("5. Retour menu principal\n");
    
            printf("Votre choix : ");
            fflush(stdin);
            scanf("%d", &choix);
    
            switch(choix){
                case 1: AddProd(NomFicheProd, &Prod);
                        printf("\nPressez une touche...");
                        getch();
                        break;
                case 2: AffProdSeq(NomFicheProd);
                        printf("\nPressez une touche...");
                        getch();
                        break;
                case 3: AffProdTri(NomFicheProd);
                        printf("\nPressez une touche...");
                        getch();
                        break;
                case 4: ModifProd(NomFicheProd);
                        printf("\nPressez une touche...");
                        getch();
                        break;
            }
        }while(choix != 5);
    }
    
    void CheckFicheProd(char* NomFicheProd, FILE *fp){
        int NbEng = 0;
    
        printf("CREER OU OUVRIR le fichier %s\n", NomFicheProd);
        printf("++++++++++++++++++++++++++++++++++++++++++++++++\n\n");
    
        fp = fopen(NomFicheProd, "rb");
    
        if(!fp){
            printf("Le fichier %s n'existe PAS\n", NomFicheProd);
            printf("Celui-ci va etre cree...\n");
            fp = fopen(NomFicheProd, "wb");
            printf("\nPressez une touche...");
            getch();
            system("cls");
        }
        else{
            printf("Le fichier %s EXISTE\n", NomFicheProd);
            fseek(fp,0,2);
            NbEng = ftell(fp)/sizeof(struct produit);
            printf("Nbr d'enregistrement dans les fichier : %d", NbEng);
            printf("\nPressez une touche...");
            getch();
        }
        fclose(fp);
    }
    
    void AddProd(char* NomFicheProd, PROD* Prod){
        char chaine[50];
    
        ////////ENTREE ID////////
        do{
            printf("Entrez l'id du produit");
            Saisie(&chaine[0]);
        }while(!CtrlIdProd(&chaine[0]));
        strcpy(chaine, (Prod)-> idProd);
    
        ////////ENTREE MARQUE////////
        do{
            printf("Entrez la marque du produit");
            Saisie(&chaine[0]);
        }while(!CtrlTaille(&chaine[0], 50));
        strcpy(chaine, (Prod)-> marque);
    
        ////////ENTREE NOM////////
        do{
            printf("Entrez le nom du produit");
            Saisie(&chaine[0]);
        }while(!CtrlTaille(&chaine[0], 50));
        strcpy(chaine, (Prod)-> nomProd);
    
        ////////ENTREE VOLUME////////
        do{
            printf("Entrez le volume");
            Saisie(&chaine[0]);
        }while(!CtrlVol(&chaine[0]));
        strcpy(chaine, (Prod)-> volume);
    
        ////////ENTREE CATEGORIE////////
        do{
            printf("Entrez la categorie du produit");
            Saisie(&chaine[0]);
        }while(!CtrlCat(&chaine[0], 40));
        strcpy(chaine, (Prod)-> categorie);
    
        InsertProd(NomFicheProd, Prod);
    }
    
    void InsertProd(char* NomFicheProd, PROD* Prod){
        FILE* fp;
        fp = fopen(NomFicheProd, "a");
        fwrite (Prod, sizeof(struct PROD), 1, NomFicheProd);
        fclose(fp);
    }
    
    void AffProdSeq(char* NomFicheProd){
    
    }
    
    void AffProdTri(char* NomFicheProd){
    
    }
    
    void ModifProd(char* NomFicheProd){
    
    }
    
    ////////FONCTIONS CONTROLE ENTREES PRODUITS////////
    int CtrlIdProd(char* NomFicheProd, char* chaine){
        int i, Ctrl = 1;
    
        if(strlen(chaine)== 13){
            for(i = 0; i < 13; i++){
                if(*(chaine + i) < '0' || *(chaine + i) > '9'){
                    Ctrl = 0;
                }
            }
        }
        else{
            Ctrl = 0;
        }
        return Ctrl;
    }
    
    int CtrlVol(char* chaine){
        int i, Ctrl = 1;
        char temp[3];
    
        if(strlen(chaine) > 0 && strlen(chaine)<= 8){ //ctrl pas vide
            while(i < (strlen(chaine)) && *(chaine + i) != ' '){
                if(*(chaine + i) < '0' || *(chaine + i) > '9'){
                    if(*(chaine)!= ','){
                        printf("pas ok nbr");
                        Ctrl = 0;
                    }
                }
                i++;
            }
            if(i > 4){
                Ctrl = 0;
                printf("pas ok taille2");
            }
        }
        else{
            Ctrl = 0;
            printf("pas ok taille1");
        }
        strcpy(temp,chaine + i + 1);
        printf("%s",temp);
        if(strcmp(temp,"kg")!= 0 || strcmp(temp,"g")!= 0 || strcmp(temp,"ml")!= 0 || strcmp(temp,"l")!= 0 || strcmp(temp,"pi")!= 0){
            Ctrl = 0;
            printf("pas ok fin");
        }
        return Ctrl;
    }
    
    int CtrlTaille(char* chaine, int taille){
        int Ctrl = 1;
    
        if(strlen(chaine)== 0 && strlen(chaine)<= taille){
            Ctrl = 0;
        }
        return Ctrl;
    }
    
    ////////FONCTIONS FOURNISSEURS////////
    void MenuFourni(char* NomFicheFourni){
        int choix = 0;
    
        CheckFicheFourni(NomFicheFourni);
    
        do{
            system("cls");
            printf("Gestion des fournisseurs\n");
            printf("°°°°°°°°°°°°°°°°°°°°°°°°\n\n");
            printf("1. Ajout d'un fournisseur\n");
            printf("2. Affichage sequentiel des fournisseurs\n");
            printf("3. Modification d'un fournisseur\n");
            printf("4. Retour menu principal\n");
    
            printf("Votre choix : ");
            fflush(stdin);
            scanf("%d", &choix);
    
            switch(choix){
                case 1: AddFourni(NomFicheFourni);
                        printf("\nPressez une touche...");
                        getch();
                        break;
                case 2: AffFourniSeq(NomFicheFourni);
                        printf("\nPressez une touche...");
                        getch();
                        break;
                case 3: ModifFourni(NomFicheFourni);
                        printf("\nPressez une touche...");
                        getch();
                        break;
            }
        }while(choix != 4);
    }
    
    void CheckFicheFourni(char* NomFicheFourni){
        FILE *fp;
        int NbEng = 0;
    
        printf("CREER OU OUVRIR le fichier %s\n", NomFicheFourni);
        printf("++++++++++++++++++++++++++++++++++++++++++++++++\n\n");
    
        fp = fopen(NomFicheFourni, "rb");
    
        if(!fp){
            printf("Le fichier %s n'existe PAS\n", NomFicheFourni);
            printf("Celui-ci va etre cree...\n");
            fp = fopen(NomFicheFourni, "wb");
            printf("\nPressez une touche...");
            getch();
            system("cls");
        }
        else{
            printf("Le fichier %s EXISTE\n", NomFicheFourni);
            fseek(fp,0,2);
            NbEng = ftell(fp)/sizeof(struct fournisseur);
            printf("Nbr d'enregistrement dans les fichier : %d", NbEng);
            printf("\nPressez une touche...");
            getch();
        }
        fclose(fp);
    }
    
    void AddFourni(char* NomFicheFourni, FOURNI* Fourni){
    char chaine[50];
    
        do{
            ////////ENTREE ID////////
            do{
                printf("Entrez l'id du fournisseur");
                Saisie(&chaine[0]);
            }while(!CtrlIdFourni(&chaine[0]));
            strcpy(chaine, (Fourni)-> idFourni);
    
            ////////ENTREE NOM////////
            do{
                printf("Entrez le nom du fournisseur");
                Saisie(&chaine[0]);
            }while(!CtrlTaille(&chaine[0], 40));
            strcpy(chaine, (Fourni)-> nomFourni);
    
            ////////ENTREE NOM VILLE////////
            do{
                printf("Entrez le nom de la ville");
                Saisie(&chaine[0]);
            }while(!CtrlTaille(&chaine[0], 50));
            strcpy(chaine, (Fourni)-> villeFourni);
    
        }while(!CtrlFourniDiff(NomFicheFourni, Fourni))
    
        InsertFourni(NomFicheFourni, Fourni);
    }
    
    void InsertFourni(char* NomFicheFourni, FOURNI* Fourni){
        FILE* fp;
        fp = fopen(NomFicheFourni, "a");
        fwrite (Fourni, sizeof(struct FOURNI), 1, NomFicheFourni);
        fclose(fp);
    }
    
    void AffFourniSeq(char* NomFicheFourni){
    
    }
    
    void ModifFourni(char* NomFicheFourni){
    
    }
    
    ////////FONCTIONS CONTROLE ENTREES FOURNISSEURS////////
    int CtrlIdFourni(char* chaine){
        int Ctrl = 1;
    
        return Ctrl;
    }
    
    int CtrlFourniDiff(char* NomFicheFourni, FOURNI* Fourni){
        int Ctrl = 1;
        return Ctrl;
    }
    
    ////////FONCTIONS ENTREES////////
    void Saisie(char* chaine){
        int i = 0;
        char c;
    
        fflush (stdin);
        printf(" : ");
    
        do{
            c = getchar();
            *chaine = c;
            chaine ++;
            i++;
        }while((i < 49) && (c != '\n'));
    
        *(--chaine) = '\0';
    }
    


    • Partager sur Facebook
    • Partager sur Twitter
      8 avril 2021 à 16:01:50

      Ligne 41, il manque le point virgule à la fin de la déclaration !

      Il y a d'autre erreurs dans ton code, mais ça va peut-être te débloquer !

      • Partager sur Facebook
      • Partager sur Twitter
        8 avril 2021 à 16:08:54

        rouloude a écrit:

        Ligne 41, il manque le point virgule à la fin de la déclaration !

        Il y a d'autre erreurs dans ton code, mais ça va peut-être te débloquer !


        Je me sens con de ne pas l'avoir vue, en effet ça règles ce problèmes là,

        merci.

        -
        Edité par ElCornet 8 avril 2021 à 16:09:11

        • Partager sur Facebook
        • Partager sur Twitter

        Grosse erreur de compilation C CodeBlocks

        × 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