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

 C Discussion :

Des erreurs bizarres


Sujet :

C

  1. #1
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Décembre 2008
    Messages
    31
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Décembre 2008
    Messages : 31
    Points : 28
    Points
    28
    Par défaut Des erreurs bizarres
    Bonjour,
    j'ai codé un petit programme qui marche parfaitement sur visual studio sans aucun probleme et sans aucune erruer affiché.
    Mais lorsque j'ai voulu compiler et executer le meme prgramme sur Unix il m'a affiché ces deux erreur suivantes pourtant j'ai bien mis les prototype de toutes les focntions dans le .h :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
     
     
    lab_lib.c:41: attention : implicit declaration of function ârecherche_cheminâ
    lab_lib.c: Hors de toute fonction :
    lab_lib.c:53: erreur: static declaration of ârecherche_cheminâ follows non-static declaration
    lab_lib.c:41: erreur: previous implicit declaration of ârecherche_cheminâ was here
    make: *** [lab_lib.o] Erreur 1
    et voici le codé source de mon petit 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
    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
    #include <stdio.h>
    #include <stdlib.h>
    #include "tab2d.h"
     
    char * afficher_lab(Un_tab2d *ptab, char *palette){
    	int l, c, i, j;
    	char * cote;
     
    	l = ptab->nb_lignes;
    	c = ptab->nb_colonnes;
    	cote = malloc((c+2)*sizeof(char));
     
    	*cote = '+';
    	for(j=0; j<c; j++){
    		cote[j+1] = '-';
    	}
    	cote[c+1] = '+';
     
    	puts(cote);
    	for(i=0; i<l; i++){
    		printf("|");
    		for(j=0; j<c; j++){
    			if(PLANTAB2D(ptab, i, j) == 0)
    				printf("%c",palette[0]);
    			else if (PLANTAB2D(ptab, i, j) == 1)
    				printf("%c",palette[1]);
    			else if (PLANTAB2D(ptab, i, j) == 2)
    				printf(".");
    			else printf("%c",palette[0]);
     
     
    		}
    		puts("|");
    	}
    	puts(cote);
    }
     
     
    Un_tab2d *chercher_chemin(Un_tab2d *ptab){
    	Un_tab2d * dup = copier_tab2d(ptab);
           if(recherche_chemin(dup, 0, 0) == 0){
    		puts("\n\t\t\t\t* PAS DE CHEMIN *");
     
    		return NULL;
    	}
    	else{
    		puts("\n\t\t\t *Voici le chemin du labyrinthe*");
    		affiche_tab(dup);
    		return dup;
    	}
    }
     
    static int recherche_chemin(Un_tab2d *ptab, int lc, int cc){
    	if((lc >= ptab->nb_lignes) || (lc < 0) || (cc >= ptab->nb_colonnes) || (cc < 0))  return 0;
    	if(PLANTAB2D(ptab, lc, cc) != 0) return 0;
     
    	if ((lc == ptab->nb_lignes-1) && (cc == ptab->nb_colonnes-1)){
    		PLANTAB2D(ptab,lc,cc) = 2;
    		return 1;
    	}
     
    	PLANTAB2D(ptab, lc, cc) = 2;
     
    	if(recherche_chemin(ptab, lc, cc+1)) return 1;
    	if(recherche_chemin(ptab, lc+1, cc)) return 1;
    	if(recherche_chemin(ptab, lc-1, cc)) return 1;
    	if(recherche_chemin(ptab, lc, cc-1)) return 1;
     
    	PLANTAB2D(ptab, lc, cc) = 3; return 0;
    }
    j'ai joint tout les fichier nécessaires.
    Je vous remercie d'avance pour touts vos suggestions.

  2. #2
    Expert éminent sénior
    Avatar de Emmanuel Delahaye
    Profil pro
    Retraité
    Inscrit en
    Décembre 2003
    Messages
    14 512
    Détails du profil
    Informations personnelles :
    Âge : 67
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Retraité

    Informations forums :
    Inscription : Décembre 2003
    Messages : 14 512
    Points : 20 985
    Points
    20 985
    Par défaut
    Citation Envoyé par Msakeni Voir le message
    et voici le codé source de mon petit 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
    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
    #include <stdio.h>
    #include <stdlib.h>
    #include "tab2d.h"
     
    char * afficher_lab(Un_tab2d *ptab, char *palette){
    	int l, c, i, j;
    	char * cote;
     
    	l = ptab->nb_lignes;
    	c = ptab->nb_colonnes;
    	cote = malloc((c+2)*sizeof(char));
     
    	*cote = '+';
    	for(j=0; j<c; j++){
    		cote[j+1] = '-';
    	}
    	cote[c+1] = '+';
     
    	puts(cote);
    	for(i=0; i<l; i++){
    		printf("|");
    		for(j=0; j<c; j++){
    			if(PLANTAB2D(ptab, i, j) == 0)
    				printf("%c",palette[0]);
    			else if (PLANTAB2D(ptab, i, j) == 1)
    				printf("%c",palette[1]);
    			else if (PLANTAB2D(ptab, i, j) == 2)
    				printf(".");
    			else printf("%c",palette[0]);
     
     
    		}
    		puts("|");
    	}
    	puts(cote);
    }
     
     
    Un_tab2d *chercher_chemin(Un_tab2d *ptab){
    	Un_tab2d * dup = copier_tab2d(ptab);
           if(recherche_chemin(dup, 0, 0) == 0){
    		puts("\n\t\t\t\t* PAS DE CHEMIN *");
     
    		return NULL;
    	}
    	else{
    		puts("\n\t\t\t *Voici le chemin du labyrinthe*");
    		affiche_tab(dup);
    		return dup;
    	}
    }
     
    static int recherche_chemin(Un_tab2d *ptab, int lc, int cc){
    	if((lc >= ptab->nb_lignes) || (lc < 0) || (cc >= ptab->nb_colonnes) || (cc < 0))  return 0;
    	if(PLANTAB2D(ptab, lc, cc) != 0) return 0;
     
    	if ((lc == ptab->nb_lignes-1) && (cc == ptab->nb_colonnes-1)){
    		PLANTAB2D(ptab,lc,cc) = 2;
    		return 1;
    	}
     
    	PLANTAB2D(ptab, lc, cc) = 2;
     
    	if(recherche_chemin(ptab, lc, cc+1)) return 1;
    	if(recherche_chemin(ptab, lc+1, cc)) return 1;
    	if(recherche_chemin(ptab, lc-1, cc)) return 1;
    	if(recherche_chemin(ptab, lc, cc-1)) return 1;
     
    	PLANTAB2D(ptab, lc, cc) = 3; return 0;
    }
    Je vous remercie d'avance pour touts vos suggestions.
    Ton code est incomplet :
    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
     
     
    -------------- Build: Debug in hello ---------------
     
    Compiling: main.c
    Linking console executable: bin\Debug\hello.exe
    C:\dev\hello\main.c:3:19: tab2d.h: No such file or directory
    C:\dev\hello\main.c:5: error: syntax error before '*' token
    C:\dev\hello\main.c:5: warning: function declaration isn't a prototype
    C:\dev\hello\main.c: In function `afficher_lab':
    C:\dev\hello\main.c:9: error: `ptab' undeclared (first use in this function)
    C:\dev\hello\main.c:9: error: (Each undeclared identifier is reported only once
    C:\dev\hello\main.c:9: error: for each function it appears in.)
    C:\dev\hello\main.c:23: warning: implicit declaration of function `PLANTAB2D'
    C:\dev\hello\main.c:24: error: `palette' undeclared (first use in this function)
    C:\dev\hello\main.c: At top level:
    C:\dev\hello\main.c:39: error: syntax error before '*' token
    C:\dev\hello\main.c:39: error: syntax error before '*' token
    C:\dev\hello\main.c:39: warning: return type defaults to `int'
    C:\dev\hello\main.c:39: warning: function declaration isn't a prototype
    C:\dev\hello\main.c: In function `chercher_chemin':
    C:\dev\hello\main.c:40: error: `Un_tab2d' undeclared (first use in this function)
    C:\dev\hello\main.c:40: error: `dup' undeclared (first use in this function)
    C:\dev\hello\main.c:40: warning: implicit declaration of function `copier_tab2d'
    C:\dev\hello\main.c:40: error: `ptab' undeclared (first use in this function)
    C:\dev\hello\main.c:41: warning: implicit declaration of function `recherche_chemin'
    C:\dev\hello\main.c:48: warning: implicit declaration of function `affiche_tab'
    C:\dev\hello\main.c: At top level:
    C:\dev\hello\main.c:53: error: syntax error before '*' token
    C:\dev\hello\main.c:53: warning: function declaration isn't a prototype
    C:\dev\hello\main.c:53: warning: static declaration of 'recherche_chemin' follows non-static declaration
    C:\dev\hello\main.c:41: warning: previous implicit declaration of 'recherche_chemin' was here
    C:\dev\hello\main.c: In function `recherche_chemin':
    C:\dev\hello\main.c:54: error: `lc' undeclared (first use in this function)
    C:\dev\hello\main.c:54: error: `ptab' undeclared (first use in this function)
    C:\dev\hello\main.c:54: error: `cc' undeclared (first use in this function)
    C:\dev\hello\main.c:58: error: invalid lvalue in assignment
    C:\dev\hello\main.c:62: error: invalid lvalue in assignment
    C:\dev\hello\main.c:69: error: invalid lvalue in assignment
    Process terminated with status 1 (0 minutes, 0 seconds)
    18 errors, 10 warnings
    Pas de Wi-Fi à la maison : CPL

  3. #3
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Décembre 2008
    Messages
    31
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Décembre 2008
    Messages : 31
    Points : 28
    Points
    28
    Par défaut
    D abord je voudrai vous remercier pour votre.
    Oui c'est vrai il n'est pas complet car il est peut long si je rjoute toute les fichier.
    Je ai joint tout les fichier du programme qui fallait sinon voila l essentiel ;

    parmi ce qu'il y a dans tab2d.h
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
     
    typedef struct 
    	{
    	unsigned int nb_colonnes;
    	unsigned int nb_lignes;
    	int *plan; //pointeur sur le tableau de nb_lignes * nb_colonnes
    	} Un_tab2d;
     
    /*****************************************************************************/
    /* Macro pour faciliter l acces a un element du plan.                        */
    /*****************************************************************************/
     
    #define PLANTAB2D(ptab2d, i, j) *((ptab2d)->plan + (((i) * (ptab2d)->nb_colonnes) + (j)))
    exemple fichier .txt :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
     
    4
    3
    1 0 1
    0 1 1
    0 0 1
    1 1 0
    fichier : tab2d.c :
    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
     
    //focntion qui permet de lire le tableau d'un fichier txt
    Un_tab2d * lire_tab2d(char * fichier){
      Un_tab2d *ptr;
      FILE * in;
      char * ligne, * s; 
      int l=0, c=0;
      int size;
     
      if((in =  fopen(fichier, "r")) == NULL){
        perror("lire_tab2d");
        exit(1);
      }
     
      //recuperation dimension de tableau et creation   
      fscanf(in, "%d\n", &l);
      fscanf(in, "%d\n", &c);
      size = c*20;
     
      ptr = creer_tab2d(l, c);
     
      //lecture de tableau
      l = 0;
      c = 0;  
      ligne = malloc(size);
      while(fgets(ligne, size, in) != NULL){
        s = strtok(ligne, " ");
        do{
          PLANTAB2D(ptr, l, c) = atoi(s); 
          s = strtok(NULL, " \n");
          c++;
        }while(s);
     
        c = 0;
        l++;
      }
      free(ligne);
        return ptr;
    }
    et voici le main :

    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
     
    int main(){
      Un_tab2d * tab;
     
      tab = lire_tab2d("fichier.txt"); 
     
      puts("\n- On va chercher un chemin dans ce labyrinthe :");
     
      afficher_lab(tab, " *");
     
      tab_bis = chercher_chemin(tab);
      afficher_lab(tab_bis, " *");
     
    return 0; 
    }

  4. #4
    Membre éclairé
    Avatar de D[r]eadLock
    Profil pro
    Inscrit en
    Mai 2002
    Messages
    504
    Détails du profil
    Informations personnelles :
    Âge : 44
    Localisation : France

    Informations forums :
    Inscription : Mai 2002
    Messages : 504
    Points : 750
    Points
    750
    Par défaut
    Citation Envoyé par Msakeni Voir le message
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
     
     
    lab_lib.c:41: attention : implicit declaration of function ârecherche_cheminâ
    lab_lib.c: Hors de toute fonction :
    lab_lib.c:53: erreur: static declaration of ârecherche_cheminâ follows non-static declaration
    lab_lib.c:41: erreur: previous implicit declaration of ârecherche_cheminâ was here
    make: *** [lab_lib.o] Erreur 1
    Les messages d'erreurs sont "explicites" (quand on les connait).
    Le premier warning te dit que recherche_chemin n'est pas connu lors de son appel et par défaut le considere comme (extern int recherche_chemin())
    L'erreur est parce qu'ensuite c'est une fonction statique.

    Pour corriger, il suffit soit de déclarer (static ...) recherche_chemin avant son premier appel, soit de déplacer l'implémentation (et donc la déclaration) avant le premier appel.

  5. #5
    Expert éminent sénior
    Avatar de Emmanuel Delahaye
    Profil pro
    Retraité
    Inscrit en
    Décembre 2003
    Messages
    14 512
    Détails du profil
    Informations personnelles :
    Âge : 67
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Retraité

    Informations forums :
    Inscription : Décembre 2003
    Messages : 14 512
    Points : 20 985
    Points
    20 985
    Par défaut
    Citation Envoyé par Msakeni Voir le message
    D abord je voudrai vous remercier pour votre.
    Oui c'est vrai il n'est pas complet car il est peut long si je rjoute toute les fichier.
    Je ai joint tout les fichier du programme qui fallait sinon voila l essentiel ;
    Ca ne suffit pas :
    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
     
     
    -------------- Build: Debug in hello ---------------
     
    Compiling: tab2d.c
    Compiling: main.c
    Linking console executable: bin\Debug\hello.exe
    C:\dev\hello\tab2d.c:3: error: syntax error before '*' token
    C:\dev\hello\tab2d.c:3: warning: return type defaults to `int'
    C:\dev\hello\tab2d.c: In function `lire_tab2d':
    C:\dev\hello\tab2d.c:4: error: `Un_tab2d' undeclared (first use in this function)
    C:\dev\hello\tab2d.c:4: error: (Each undeclared identifier is reported only once
    C:\dev\hello\tab2d.c:4: error: for each function it appears in.)
    C:\dev\hello\tab2d.c:4: error: `ptr' undeclared (first use in this function)
    C:\dev\hello\tab2d.c:5: error: `FILE' undeclared (first use in this function)
    C:\dev\hello\tab2d.c:5: error: `in' undeclared (first use in this function)
    C:\dev\hello\tab2d.c:6: warning: ISO C90 forbids mixed declarations and code
    C:\dev\hello\tab2d.c:10: warning: implicit declaration of function `fopen'
    C:\dev\hello\tab2d.c:10: error: `NULL' undeclared (first use in this function)
    C:\dev\hello\tab2d.c:11: warning: implicit declaration of function `perror'
    C:\dev\hello\tab2d.c:12: warning: implicit declaration of function `exit'
    C:\dev\hello\tab2d.c:16: warning: implicit declaration of function `fscanf'
    C:\dev\hello\tab2d.c:20: warning: implicit declaration of function `creer_tab2d'
    C:\dev\hello\tab2d.c:25: warning: implicit declaration of function `malloc'
    C:\dev\hello\tab2d.c:26: warning: implicit declaration of function `fgets'
    C:\dev\hello\tab2d.c:27: warning: implicit declaration of function `strtok'
    C:\dev\hello\tab2d.c:27: warning: assignment makes pointer from integer without a cast
    C:\dev\hello\tab2d.c:29: warning: implicit declaration of function `PLANTAB2D'
    C:\dev\hello\tab2d.c:29: warning: implicit declaration of function `atoi'
    C:\dev\hello\tab2d.c:29: error: invalid lvalue in assignment
    C:\dev\hello\tab2d.c:30: warning: assignment makes pointer from integer without a cast
    C:\dev\hello\tab2d.c:37: warning: implicit declaration of function `free'
    Process terminated with status 1 (0 minutes, 0 seconds)
    9 errors, 15 warnings
     
    C:\dev\hello\main.c: In function `afficher_lab':
    C:\dev\hello\main.c:36: warning: control reaches end of non-void function
    C:\dev\hello\main.c: In function `chercher_chemin':
    C:\dev\hello\main.c:40: warning: implicit declaration of function `copier_tab2d'
    C:\dev\hello\main.c:40: warning: initialization makes pointer from integer without a cast
    C:\dev\hello\main.c:41: warning: implicit declaration of function `recherche_chemin'
    C:\dev\hello\main.c:48: warning: implicit declaration of function `affiche_tab'
    C:\dev\hello\main.c: At top level:
    C:\dev\hello\main.c:53: warning: static declaration of 'recherche_chemin' follows non-static declaration
    C:\dev\hello\main.c:41: warning: previous implicit declaration of 'recherche_chemin' was here
    C:\dev\hello\main.c: In function `recherche_chemin':
    C:\dev\hello\main.c:54: warning: comparison between signed and unsigned
    C:\dev\hello\main.c:54: warning: comparison between signed and unsigned
    C:\dev\hello\main.c:57: warning: comparison between signed and unsigned
    C:\dev\hello\main.c:57: warning: comparison between signed and unsigned
    Process terminated with status 0 (0 minutes, 0 seconds)
    9 errors, 26 warnings
    Pas de Wi-Fi à la maison : CPL

  6. #6
    Expert éminent sénior
    Avatar de Emmanuel Delahaye
    Profil pro
    Retraité
    Inscrit en
    Décembre 2003
    Messages
    14 512
    Détails du profil
    Informations personnelles :
    Âge : 67
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Retraité

    Informations forums :
    Inscription : Décembre 2003
    Messages : 14 512
    Points : 20 985
    Points
    20 985
    Par défaut
    Citation Envoyé par Emmanuel Delahaye Voir le message
    Ca ne suffit pas :
    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
     
     
    -------------- Build: Debug in hello ---------------
     
    Compiling: tab2d.c
    Compiling: main.c
    Linking console executable: bin\Debug\hello.exe
    C:\dev\hello\tab2d.c:3: error: syntax error before '*' token
    C:\dev\hello\tab2d.c:3: warning: return type defaults to `int'
    C:\dev\hello\tab2d.c: In function `lire_tab2d':
    C:\dev\hello\tab2d.c:4: error: `Un_tab2d' undeclared (first use in this function)
    C:\dev\hello\tab2d.c:4: error: (Each undeclared identifier is reported only once
    C:\dev\hello\tab2d.c:4: error: for each function it appears in.)
    C:\dev\hello\tab2d.c:4: error: `ptr' undeclared (first use in this function)
    C:\dev\hello\tab2d.c:5: error: `FILE' undeclared (first use in this function)
    C:\dev\hello\tab2d.c:5: error: `in' undeclared (first use in this function)
    C:\dev\hello\tab2d.c:6: warning: ISO C90 forbids mixed declarations and code
    C:\dev\hello\tab2d.c:10: warning: implicit declaration of function `fopen'
    C:\dev\hello\tab2d.c:10: error: `NULL' undeclared (first use in this function)
    C:\dev\hello\tab2d.c:11: warning: implicit declaration of function `perror'
    C:\dev\hello\tab2d.c:12: warning: implicit declaration of function `exit'
    C:\dev\hello\tab2d.c:16: warning: implicit declaration of function `fscanf'
    C:\dev\hello\tab2d.c:20: warning: implicit declaration of function `creer_tab2d'
    C:\dev\hello\tab2d.c:25: warning: implicit declaration of function `malloc'
    C:\dev\hello\tab2d.c:26: warning: implicit declaration of function `fgets'
    C:\dev\hello\tab2d.c:27: warning: implicit declaration of function `strtok'
    C:\dev\hello\tab2d.c:27: warning: assignment makes pointer from integer without a cast
    C:\dev\hello\tab2d.c:29: warning: implicit declaration of function `PLANTAB2D'
    C:\dev\hello\tab2d.c:29: warning: implicit declaration of function `atoi'
    C:\dev\hello\tab2d.c:29: error: invalid lvalue in assignment
    C:\dev\hello\tab2d.c:30: warning: assignment makes pointer from integer without a cast
    C:\dev\hello\tab2d.c:37: warning: implicit declaration of function `free'
    Process terminated with status 1 (0 minutes, 0 seconds)
    9 errors, 15 warnings
     
    C:\dev\hello\main.c: In function `afficher_lab':
    C:\dev\hello\main.c:36: warning: control reaches end of non-void function
    C:\dev\hello\main.c: In function `chercher_chemin':
    C:\dev\hello\main.c:40: warning: implicit declaration of function `copier_tab2d'
    C:\dev\hello\main.c:40: warning: initialization makes pointer from integer without a cast
    C:\dev\hello\main.c:41: warning: implicit declaration of function `recherche_chemin'
    C:\dev\hello\main.c:48: warning: implicit declaration of function `affiche_tab'
    C:\dev\hello\main.c: At top level:
    C:\dev\hello\main.c:53: warning: static declaration of 'recherche_chemin' follows non-static declaration
    C:\dev\hello\main.c:41: warning: previous implicit declaration of 'recherche_chemin' was here
    C:\dev\hello\main.c: In function `recherche_chemin':
    C:\dev\hello\main.c:54: warning: comparison between signed and unsigned
    C:\dev\hello\main.c:54: warning: comparison between signed and unsigned
    C:\dev\hello\main.c:57: warning: comparison between signed and unsigned
    C:\dev\hello\main.c:57: warning: comparison between signed and unsigned
    Process terminated with status 0 (0 minutes, 0 seconds)
    9 errors, 26 warnings
    Ton code est toujours incomplet. On ne va pas passer la journée à jouer aux devinettes. C'est à toi de poster un code complet réduit au minimum qui montre le défaut (c'est d'ailleurs, en soi, une méthode de mise au moint bien connue et très efficace...). Et STP, vérifie ce que tu postes...
    Pas de Wi-Fi à la maison : CPL

  7. #7
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Décembre 2008
    Messages
    31
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Décembre 2008
    Messages : 31
    Points : 28
    Points
    28
    Par défaut
    en fait j'ai reussi à resoudre l'erreur " static declaration of ârecherche_cheminâ follows non-static declaration "
    il fallait just definir la fonction ( static int recherche_chemin ) avant
    la fonction ( Un_tab2d *chercher_chemin ) car elle fait appel à la pemiere.

  8. #8
    Membre éprouvé Avatar de orfix
    Homme Profil pro
    Inscrit en
    Avril 2007
    Messages
    707
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Maroc

    Informations professionnelles :
    Secteur : High Tech - Produits et services télécom et Internet

    Informations forums :
    Inscription : Avril 2007
    Messages : 707
    Points : 1 132
    Points
    1 132
    Par défaut
    Peu importe l'ordre de définition des fonctions si tu ajoutes leurs prototypes dans ton header, c'est ce qui se fait d'habitude.
    To start press any key. (reading screen) Where's the "any" key? I see Esc, Catarl, and Pig Up. There doesn't seem to be any "any" key. Wo! All this computer hacking is making me thirsty. I think I'll order a Tab. (presses TAB key). -- HOMER --

  9. #9
    gl
    gl est déconnecté
    Rédacteur

    Homme Profil pro
    Inscrit en
    Juin 2002
    Messages
    2 165
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 45
    Localisation : France, Isère (Rhône Alpes)

    Informations forums :
    Inscription : Juin 2002
    Messages : 2 165
    Points : 4 637
    Points
    4 637
    Par défaut
    Citation Envoyé par ssmario2 Voir le message
    Peu importe l'ordre de définition des fonctions si tu ajoutes leurs prototypes dans ton header, c'est ce qui se fait d'habitude.
    C'est ce qui se fait pour les fonctions "publiques". Les fonctions internes à l'unité de compilation non rien à faire dans le header et doivent être en "static".

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. [QReport] Erreur bizarre
    Par vali dans le forum Composants VCL
    Réponses: 3
    Dernier message: 01/03/2009, 01h25
  2. [Eclipse 3.0]Affichage des erreurs
    Par alfsalim dans le forum Eclipse Java
    Réponses: 1
    Dernier message: 12/07/2004, 17h33
  3. Réponses: 8
    Dernier message: 18/05/2004, 10h03
  4. [XSLT]Est ce qu'il y'a la gestion des erreur en xslt ?
    Par miloud dans le forum XSL/XSLT/XPATH
    Réponses: 2
    Dernier message: 04/02/2004, 17h19
  5. [LG]gestion des erreurs
    Par frontin dans le forum Langage
    Réponses: 3
    Dernier message: 29/11/2003, 22h41

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