Problème de compilation

Littlenico Messages postés 70 Statut Membre -  
Littlenico Messages postés 70 Statut Membre -
Bonjours à tous.
je suis nouveau dans la programmation et lorsque je demande à linux de me compiler un fichier il me répon "no newline at end of file".
Que dois je faire ?
merci
Configuration: linux mandriva 2006

3 réponses

  1. lami20j Messages postés 21506 Date d'inscription   Statut Modérateur, Contributeur sécurité Dernière intervention   3 571
     
    no newline at end of file

    pas de nouvelle ligne à la fin de fichier

    Que dois je faire ?
    Affiche ton code s'il n'est pas confidentiel.
    0
    1. Littlenico Messages postés 70 Statut Membre 2
       
      Quel code ?
      0
    2. lami20j Messages postés 21506 Date d'inscription   Statut Modérateur, Contributeur sécurité Dernière intervention   3 571 > Littlenico Messages postés 70 Statut Membre
       
      compiler un fichier

      Quel fichier?
      0
    3. Littlenico Messages postés 70 Statut Membre 2 > lami20j Messages postés 21506 Date d'inscription   Statut Modérateur, Contributeur sécurité Dernière intervention  
       
      c'est un fichier tout simple. un fichier C++ qui est censé m'écrire "bonjour" (j'y ai inclus des bibliothèques)
      0
    4. lami20j Messages postés 21506 Date d'inscription   Statut Modérateur, Contributeur sécurité Dernière intervention   3 571 > Littlenico Messages postés 70 Statut Membre
       
      Alors quand j'ai dit code j'ai pensé au code source de ton fichier.

      En bref, fait une copier/coller de ton fichier pour voir le code ( ton programme )
      0
    5. Littlenico Messages postés 70 Statut Membre 2 > lami20j Messages postés 21506 Date d'inscription   Statut Modérateur, Contributeur sécurité Dernière intervention  
       
      ah OK. lol. alors le code c'est :
      #include /home/nicolas/TRAVAIL/entreeSortie.h
      #include /home/nicolas/TRAVAIL/chaine.h

      int main ()
      {
      ecrire(uneChaine("bojour"));
      }


      et entreeSortie est la bibliothèque des procédures "lire" et "ecrire"
      et chaine est la bibliothèque des cahines de charactères
      0
  2. Littlenico Messages postés 70 Statut Membre 2
     
    POUR ENTREESORTIE :

    partie spécification :

    #ifndef _ENTREE_SORTIE_H
    #define _ENTREE_SORTIE_H

    #include "chaine.h"

    //------------------------------------------------------------------------------
    // SPECIFICATION DES SOUS-PROGRAMMES DE LECTURE SUR L'ENTREE STANDARD
    // CHAQUE LECTURE DOIT ETRE VALIDEE PAR L'APPUI SUR LA TOUCHE <ENTREE>
    //------------------------------------------------------------------------------

    // attend l'appui sur la touche <ENTREE>
    void lire () ;

    // lit un booleen v
    // si la valeur lue est 1, le booleen v prend la valeur true
    // si la valeur lue est 0, le booleen v prend la valeur false
    // leve l'exception "LECTURE BOOLEEN INCORRECTE" si la saisie est incorrecte
    void lire (bool & v) throw (Chaine) ;

    // lit un caractere v
    // leve l'exception "LECTURE CARACTERE INCORRECTE" si la saisie est incorrecte
    void lire (char & v) throw (Chaine) ;

    // lit un entier court v
    // leve l'exception "LECTURE ENTIER COURT INCORRECTE" si la saisie est
    // incorrecte
    void lire (short & v) throw (Chaine) ;

    // lit un entier court non signe v
    // leve l'exception "LECTURE ENTIER COURT NON SIGNE INCORRECTE" si la saisie
    // est incorrecte
    void lire (unsigned short & v) throw (Chaine) ;

    // lit un entier v
    // leve l'exception "LECTURE ENTIER INCORRECTE" si la saisie est incorrecte
    void lire (int & v) throw (Chaine) ;

    // lit un entier non signe
    // leve l'exception "LECTURE ENTIER NON SIGNE INCORRECTE" si la saisie est
    // incorrecte
    void lire (unsigned int & v) throw (Chaine) ;

    // lit un entier long v
    // leve l'exception "LECTURE ENTIER LONG INCORRECTE" si la saisie est incorrecte
    void lire (long & v) throw (Chaine) ;

    // lit un entier long non signe v
    // leve l'exception "LECTURE ENTIER LONG NON SIGNE INCORRECTE" si la saisie est
    // incorrecte
    void lire (unsigned long & v) throw (Chaine) ;

    // lit un reel v
    // leve l'exception "LECTURE REEL INCORRECTE" si la saisie est incorrecte
    void lire (float & v) throw (Chaine) ;

    // lit un reel double precision v
    // leve l'exception "LECTURE REEL DOUBLE PRECISION INCORRECTE" si la saisie est
    // incorrecte
    void lire (double & v) throw (Chaine) ;

    // lit une chaine ch sur l'entree standard
    // leve l'exception "LECTURE CHAINE INCORRECTE" si la saisie est incorrecte
    void lire (Chaine & ch) throw (Chaine) ;

    //------------------------------------------------------------------------------
    // SPECIFICATION DES SOUS-PROGRAMMES D'ECRITURE SUR LA SORTIE STANDARD
    // LES IDENTIFICATEURS DE SOUS-PROGRAMMES SE TERMINANT PAR NL POSITIONNENT
    // LE CURSEUR AU DEBUT DE LA LIGNE SUIVANTE APRES AVOIR EFFECTUE L'ECRITURE
    //------------------------------------------------------------------------------

    // positionne le curseur en debut de ligne suivante
    void ecrireNL () ;

    // ecrit un booleen v
    // si v a pour valeur true, la valeur affichee est egale a 1
    // si v a pour valeur false, la valeur affichee est egale a 0
    void ecrire (const bool v) ;
    void ecrireNL (const bool v);

    // ecrit un caractere v
    void ecrire (const char v) ;
    void ecrireNL (const char v) ;

    // ecrit un entier court v
    void ecrire (const short v) ;
    void ecrireNL (const short v) ;

    // ecrit un entier court non signe v
    void ecrire (const unsigned short v) ;
    void ecrireNL (const unsigned short v) ;

    // ecrit un entier v
    void ecrire (const int v) ;
    void ecrireNL (const int v) ;

    // ecrit un entier non signe v
    void ecrire (const unsigned int v) ;
    void ecrireNL (const unsigned int v) ;

    // ecrit un entier long v
    void ecrire (const long v) ;
    void ecrireNL (const long v) ;

    // ecrit un entier long non signe v
    void ecrire (const unsigned long v) ;
    void ecrireNL (const unsigned long v) ;

    // ecrit un reel v avec nb chiffres apres le point decimal
    void ecrire (const float v, const int nb) ;
    void ecrireNL (const float v, const int nb) ;

    // ecrit un reel double precision v avec nb chiffres apres le point decimal
    void ecrire (const double v, const int nb) ;
    void ecrireNL (const double v, const int nb) ;

    // ecrit une chaine ch sur la sortie standard
    void ecrire (const Chaine ch) ;

    // ecrit une chaine ch sur la sortie standard suivie d'un retour a la ligne
    void ecrireNL (const Chaine ch) ;

    //------------------------------------------------------------------------------
    // SPECIFICATION DES SOUS-PROGRAMMES DE GESTION DE L'AFFICHAGE ECRAN
    //------------------------------------------------------------------------------

    // remet a blanc l'ecran et positionne le curseur en haut a gauche de l'ecran
    void effacer() ;

    // positionne l'affichage en mode video inverse
    void inverser() ;

    // positionne l'affichage en mode normal
    void normal () ;

    // positionne l'affichage en gras
    void gras () ;

    // emet un beep sonore
    void beep () ;

    // positionne le curseur en ligne l et colonne c
    void allerLC (const int l, const int c) ;

    #endif

    partie implémentation :

    //------------------------------------------------------------------------------
    // IMPORTATION DES BIBLIOTHEQUES UTILISEES
    //------------------------------------------------------------------------------
    #include <iostream>
    #include <iomanip>
    #include "entreeSortie.h"

    using namespace std ;

    static bool indic = false ;

    //------------------------------------------------------------------------------
    // SOUS-PROGRAMMES
    //------------------------------------------------------------------------------
    void allerLC (const int x, const int y)
    {
    cout <<"\033[" <<x <<";" <<y <<"H" <<flush ;
    }

    void effacer ()
    {
    cout <<"\033[H\033[J" <<flush ;
    }

    void inverser ()
    {
    cout <<"\033[7m" <<flush ;
    }

    void normal ()
    {
    cout <<"\033[0m" <<flush ;
    }

    void gras ()
    {
    cout <<"\033[1m" <<flush ;
    }

    void beep ()
    {
    cout <<"\007" <<flush ;
    }

    void lire ()
    {
    char c [255+1] ;
    cout <<"\ntaper sur ENTREE pour continuer ..." <<endl ;
    if (indic)
    {
    indic = false ;
    cin.getline (c, 256, '\n') ;
    }
    cin.getline (c, 256, '\n') ;
    }

    void lire (bool & v) throw (Chaine)
    {
    cin >>v ;
    indic = true ;
    if (! cin.good ())
    {
    throw uneChaine ("LECTURE BOOLEEN INCORRECTE") ;
    }
    }

    void lire (char & v) throw (Chaine)
    {
    if (indic)
    {
    cin >>ws ;
    }
    cin >>v ;
    indic = true ;
    if (! cin.good ())
    {
    throw uneChaine ("LECTURE CARACTERE INCORRECTE") ;
    }
    }

    void lire (short & v) throw (Chaine)
    {
    cin >>v ;
    indic = true ;
    if (! cin.good ())
    {
    throw uneChaine ("LECTURE ENTIER COURT INCORRECTE") ;
    }
    }

    void lire (unsigned short & v) throw (Chaine)
    {
    cin >>v ;
    indic = true ;
    if (! cin.good ())
    {
    throw uneChaine ("LECTURE ENTIER COURT NON SIGNE INCORRECTE") ;
    }
    }

    void lire (int & v) throw (Chaine)
    {
    cin >>v ;
    if (! cin.good ())
    {
    throw uneChaine ("LECTURE ENTIER INCORRECTE") ;
    }
    indic = true ;
    }

    void lire (unsigned int & v) throw (Chaine)
    {
    cin >>v ;
    indic = true ;
    if (! cin.good ())
    {
    throw uneChaine ("LECTURE ENTIER NON SIGNE INCORRECTE") ;
    }
    }

    void lire (long & v) throw (Chaine)
    {
    cin >>v ;
    indic = true ;
    if (! cin.good ())
    {
    throw uneChaine ("LECTURE ENTIER LONG INCORRECTE") ;
    }
    }

    void lire (unsigned long & v) throw (Chaine)
    {
    cin >>v ;
    indic = true ;
    if (! cin.good ())
    {
    throw uneChaine ("LECTURE ENTIER LONG NON SIGNE INCORRECTE") ;
    }
    }

    void lire (float & v) throw (Chaine)
    {
    cin >>v ;
    indic = true ;
    if (! cin.good ())
    {
    throw uneChaine ("LECTURE REEL INCORRECTE") ;
    }
    }

    void lire (double & v) throw (Chaine)
    {
    cin >>v ;
    indic = true ;
    if (! cin.good ())
    {
    throw uneChaine ("LECTURE REEL DOUBLE PRECISION INCORRECTE") ;
    }
    }

    void lire (Chaine & ch) throw (Chaine)
    {
    if (indic)
    {
    indic = false ;
    cin.getline (ch.chaine, 256, '\n') ;
    }
    cin.getline (ch.chaine, 256, '\n') ;
    if (! cin.good ())
    {
    throw uneChaine ("LECTURE CHAINE INCORRECTE") ;
    }
    }

    void ecrire (const bool v)
    {
    cout <<v <<flush ;
    }

    void ecrireNL (const bool v)
    {
    cout <<v <<endl ;
    }

    void ecrire (const char v)
    {
    cout <<v <<flush ;
    }

    void ecrireNL (const char v)
    {
    cout <<v <<endl ;
    }

    void ecrire (const short v)
    {
    cout <<v <<flush ;
    }

    void ecrireNL (const short v)
    {
    cout <<v <<endl ;
    }

    void ecrire (const unsigned short v)
    {
    cout <<v <<flush ;
    }

    void ecrireNL (const unsigned short v)
    {
    cout <<v <<endl ;
    }

    void ecrire (const int v)
    {
    cout <<v <<flush ;
    }

    void ecrireNL (const int v)
    {
    cout <<v <<endl ;
    }

    void ecrire (const unsigned int v)
    {
    cout <<v <<flush ;
    }

    void ecrireNL (const unsigned int v)
    {
    cout <<v <<endl ;
    }

    void ecrire (const long v)
    {
    cout <<v <<flush ;
    }

    void ecrireNL (const long v)
    {
    cout <<v <<endl ;
    }

    void ecrire (const unsigned long v)
    {
    cout <<v <<flush ;
    }

    void ecrireNL (const unsigned long v)
    {
    cout <<v <<endl ;
    }

    void ecrire (const float v, const int nb)
    {
    cout.setf (ios::fixed, ios::floatfield) ;
    cout <<setprecision (nb) <<v <<flush ;
    }

    void ecrireNL (const float v, const int nb)
    {
    cout.setf (ios::fixed, ios::floatfield) ;
    cout <<setprecision (nb) <<v <<endl ;
    }

    void ecrire (const double v, const int nb)
    {
    cout.setf(ios::fixed, ios::floatfield) ;
    cout <<setprecision (nb) ;
    cout <<v <<flush;
    }

    void ecrireNL (const double v, const int nb)
    {
    cout.setf(ios::fixed, ios::floatfield) ;
    cout <<setprecision (nb) ;
    cout <<v <<endl ;
    }

    void ecrireNL ()
    {
    cout <<endl ;
    }

    void ecrire (const Chaine ch)
    {
    cout <<ch.chaine <<flush ;
    }

    void ecrireNL (const Chaine ch)
    {
    cout <<ch.chaine <<endl ;
    }
    0
  3. dedale82 Messages postés 403 Statut Membre 283
     
    Salut,
    à mon avis, il suffit de rajouter une ligne vide à la fin de ton fichier et ça devrait suffire. Tu essayes de compiler avec Gcc ou DevC++?
    A plus
    0
    1. Littlenico Messages postés 70 Statut Membre 2
       
      slt dedale82.
      pour l'instant j'utilise mandriva donc je compile avec la commande g++ -c
      0