error: ld returned 1 exit status
Répondre à la discussion
Affichage des résultats 1 à 7 sur 7

error: ld returned 1 exit status



  1. #1
    invite71dcc7ad

    Question error: ld returned 1 exit status


    ------

    Lorsque j'essaie d'exécuter mon programme, j'obtiens une erreur en disant que ld a renvoyé 1 état de sortie et je ne peux pas comprendre pourquoi. J'ai vérifié toute l'orthographe et le type de variables mais cela ne fonctionnera toujours pas. De plus, l'erreur est sur la ligne où j'appelle la fonction de rapport d'annulation.


    Code:
    #include <iostream>
    #include <string>
    #include <fstream>
    using namespace std;
    
    const int STUDENTS = 10;
    const int SCORES = 5;
    void namesAndGrades(string name[], int id[], int grade[][SCORES], int oGrade[]);
    void letterGrd (string letter[], int oGrade[]);
    void output (string name[], string letter[], int id[], int grade[][SCORES], int oGrade[]);
    void highestGrade(int highScore, string highName, string name[], int oGrade[]);
    void searchName(string name[], string search);
    void report(string name[], string letter[], int id[], int grade[][SCORES], int oGrade[]);
    
    int main(){
      int ids[STUDENTS];
      string names[STUDENTS];
      int grades[STUDENTS][SCORES];
      int overGrade[STUDENTS] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
      string ltrGrade[STUDENTS];
      int highGrade=0;
      string bestGrade;
      string searchTerm;
      int avg=0;
    
      namesAndGrades (names, ids, grades, overGrade);
      letterGrd (ltrGrade, overGrade);
      output (names, ltrGrade, ids, grades, overGrade);
      highestGrade (highGrade, bestGrade, names, overGrade);
      searchName (names, searchTerm);
      report (names, ltrGrade, ids, grades, overGrade);
    
    return 0;
    }
    
    void namesAndGrades(string name[], int id[], int grade[][SCORES], int oGrade[]){
      char o;
      ifstream inFile;
      inFile.open("data121.txt");
      if ("data121.txt"){
        for(int x=0; x<STUDENTS; x++){
          inFile >> id[x]>>o;
          getline(inFile, name[x], ',');
          for(int y=0; y<SCORES;y++){
            inFile>>grade[x][y]>>o;
            oGrade[x]+=grade[x][y];
            }
          }
        }
        inFile.close();
    }
    
    void letterGrd (string letter[], int oGrade[]){
      for(int i=0;i<STUDENTS;i++){
        if (oGrade[i]>=90)
          letter[i]= "A";
        else if (oGrade[i]<90 && oGrade[i]>=80)
          letter[i]="B";
        else if (oGrade[i]<80 && oGrade[i]>=70)
          letter[i]="C";
        else if (oGrade[i]<70 && oGrade[i]>=60)
          letter[i]="D";
        else if (oGrade[i]<60)
          letter[i]="F";
      }
    }
    
    void output (string name[], string letter[], int id[], int grade[][SCORES], int oGrade[]){
      for (int x=0; x<STUDENTS; x++){
        cout<< id[x]<<" "<<name[x]<<" ";
        for (int y=0; y<SCORES; y++){
          cout<< grade[x][y]<<" ";
        }
        cout<< oGrade[x]<<" "<<letter[x]<<endl;
      }
    }
    
    void highestGrade(int bestScore, string highName, string name[], int oGrade[]){
      for (int x=0; x<STUDENTS; x++){
        if (oGrade[x] > bestScore){
          highName = name[x];
          bestScore = oGrade[x];
        }
      }
      cout<<highName<<" "<<bestScore<<endl;
    }
    
    void searchName(string name[], string search){
      bool found;
      cout<< "Please enter the name of the student you would like to look up: ";
      getline(cin, search);
      for (int x=0; x<STUDENTS; x++){
        if (name[x]==search){
          found=true;
          break;
        }
      }
        if (found)
          cout<<"Found the record of "<<search<<endl;
        else
          cout<< "No record found"<<endl;
    }
    
    void reprot(string name[], string letter[], int id[], int grade[][SCORES], int oGrade[]){
      ofstream outFile;
      outFile.open("report121.txt");
      for (int x=0; x<STUDENTS; x++){
        outFile<<id[x]<<" "<<name[x]<<" ";
        for(int y=0; y<SCORES; y++){
          outFile<<grade[x][y]<<" ";
        }
        outFile<<oGrade[x]<<" "<<letter[x]<<endl;
      }
      outFile.close();
    }
    merci

    -----

  2. #2
    pm42

    Re : error: ld returned 1 exit status

    Normal : ta fonction déclarée en haut comme report s’appelle reprot en bas.

  3. #3
    invite71dcc7ad

    Re : error: ld returned 1 exit status

    Normal : ta fonction déclarée en haut comme report sappelle reprot en bas.
    Quelle fonction exactement?

  4. #4
    pm42

    Re : error: ld returned 1 exit status

    Citation Envoyé par faaramin Voir le message
    Quelle fonction exactement?
    Fais un effort.

  5. A voir en vidéo sur Futura
  6. #5
    invite71dcc7ad

    Re : error: ld returned 1 exit status

    Je travaille sur cette application pendant 4 jours
    Mais ça fait une erreur
    Je ne comprends pas pourquoi!

    Code:
    #include <iostream>
    #include <string>
    #include <fstream>
    using namespace std;
    
    const int STUDENTS = 10;
    const int SCORES = 5;
    void namesAndGrades(string name[], int id[], int grade[][SCORES], int oGrade[]);
    void letterGrd (string letter[], int oGrade[]);
    void output (string name[], string letter[], int id[], int grade[][SCORES], int oGrade[]);
    void highestGrade(int highScore, string highName, string name[], int oGrade[]);
    void searchName(string name[], string search);
    void report(string name[], string letter[], int id[], int grade[][SCORES], int oGrade[]);
    
    int main(){
      int ids[STUDENTS];
      string names[STUDENTS];
      int grades[STUDENTS][SCORES];
      int overGrade[STUDENTS] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
      string ltrGrade[STUDENTS];
      int highGrade=0;
      string bestGrade;
      string searchTerm;
      int avg=0;
    
      namesAndGrades (names, ids, grades, overGrade);
      letterGrd (ltrGrade, overGrade);
      output (names, ltrGrade, ids, grades, overGrade);
      highestGrade (highGrade, bestGrade, names, overGrade);
      searchName (names, searchTerm);
      report (names, ltrGrade, ids, grades, overGrade);
    
    return 0;
    }
    
    void namesAndGrades(string name[], int id[], int grade[][SCORES], int oGrade[]){
      char o;
      ifstream inFile;
      inFile.open("data121.txt");
      if ("data121.txt"){
        for(int x=0; x<STUDENTS; x++){
          inFile >> id[x]>>o;
          getline(inFile, name[x], ',');
          for(int y=0; y<SCORES;y++){
            inFile>>grade[x][y]>>o;
            oGrade[x]+=grade[x][y];
            }
          }
        }
        inFile.close();
    }
    
    void letterGrd (string letter[], int oGrade[]){
      for(int i=0;i<STUDENTS;i++){
        if (oGrade[i]>=90)
          letter[i]= "A";
        else if (oGrade[i]<90 && oGrade[i]>=80)
          letter[i]="B";
        else if (oGrade[i]<80 && oGrade[i]>=70)
          letter[i]="C";
        else if (oGrade[i]<70 && oGrade[i]>=60)
          letter[i]="D";
        else if (oGrade[i]<60)
          letter[i]="F";
      }
    }
    
    void output (string name[], string letter[], int id[], int grade[][SCORES], int oGrade[]){
      for (int x=0; x<STUDENTS; x++){
        cout<< id[x]<<" "<<name[x]<<" ";
        for (int y=0; y<SCORES; y++){
          cout<< grade[x][y]<<" ";
        }
        cout<< oGrade[x]<<" "<<letter[x]<<endl;
      }
    }
    
    void highestGrade(int bestScore, string highName, string name[], int oGrade[]){
      for (int x=0; x<STUDENTS; x++){
        if (oGrade[x] > bestScore){
          highName = name[x];
          bestScore = oGrade[x];
        }
      }
      cout<<highName<<" "<<bestScore<<endl;
    }
    
    void searchName(string name[], string search){
      bool found;
      cout<< "Please enter the name of the student you would like to look up: ";
      getline(cin, search);
      for (int x=0; x<STUDENTS; x++){
        if (name[x]==search){
          found=true;
          break;
        }
      }
        if (found)
          cout<<"ثبت دامنه "<<search<<endl;
        else
          cout<< "طراحی سایت"<<endl;
    }
    
    void reprot(string name[], string letter[], int id[], int grade[][SCORES], int oGrade[]){
      ofstream outFile;
      outFile.open("report121.txt");
      for (int x=0; x<STUDENTS; x++){
        outFile<<id[x]<<" "<<name[x]<<" ";
        for(int y=0; y<SCORES; y++){
          outFile<<grade[x][y]<<" ";
        }
        outFile<<oGrade[x]<<" "<<letter[x]<<endl;
      }
      outFile.close();
    }

  7. #6
    Kissagogo27

    Re : error: ld returned 1 exit status

    Bonjour, la dernière partie

    void reprot(string name[], string letter[], int id[], int grade[][SCORES], int oGrade[]){

  8. #7
    Jack
    Modérateur

    Re : error: ld returned 1 exit status

    Je me demande d'ailleurs comment tu as pu exécuter ce programme vu qu'il ne peut pas compiler, donc pas d'exécutable.

    Je ne comprends pas non plus pourquoi aucun message d'erreur ne s'affiche.

Discussions similaires

  1. Undelivered Mail Returned to Sender retour freebox
    Par invitedc60149b dans le forum Internet - Réseau - Sécurité générale
    Réponses: 6
    Dernier message: 26/07/2017, 16h29
  2. Status de Solterra
    Par invite43c3a29d dans le forum Environnement, développement durable et écologie
    Réponses: 3
    Dernier message: 04/11/2010, 13h14
  3. IRP bit, STATUS??
    Par Thetimax dans le forum Électronique
    Réponses: 11
    Dernier message: 01/08/2010, 19h42
  4. Emergency Exit
    Par invite2bab68d1 dans le forum Astronautique
    Réponses: 5
    Dernier message: 11/07/2007, 23h23
  5. Exit le bromure de méthyle...
    Par invitef1496cbf dans le forum Biologie
    Réponses: 3
    Dernier message: 21/11/2005, 12h56