[Linker error] undefined reference to ..
Bonjour à tous :)
j'ai un probleme de compilation et je sais pas d'où il vient
en fait ce sonr 2 erreurs:
1- [Linker error] undefined reference to `hash_cle'
2- ld returned 1 exit status
:bug:
voilà le main
Code:
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 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include "table_hash.h"
#define TAILLEHASH 307
#define NBRSEQ 10
#define SEUIL 3
#define SEUIL 3
int main()
{
FILE *F=NULL;
char mot[100];
int i,j;
unsigned int cle,pt;
int nl=1, pos=1;
//nl=pos=1;
int f;
char c;
//int seuil;
//Liste **L;
Liste *seq2=NULL;
Liste **seq;
Liste **TableHash;
TableHash = (Liste **) malloc (TAILLEHASH * sizeof(Liste *));
for(i=0;i<TAILLEHASH;++i)
TableHash[i] = NULL;
pt=hash_cle(".");
//printf("%d",pt);
printf("debut du programme \n----------------------------------\n");
F=fopen("C:\\Users\\Cyrine\\Desktop\\Desktop\\projet\\projet\\essai.txt","r");
printf("Ouverture du Fichier \n----------------------------------\n");
while(fscanf(F,"%s",mot)==1){
cle = HashCode(mot);
if ((cle!=pt ) && (! ChercherMotDansTableHash(TableHash,mot)))
TableHash[cle] = InsertionEnTete(TableHash[cle],mot);
if(fgetc(F)==EOF)
break;
}
fclose(F);
scanf("%s", c);
}
unsigned int HashCode (char *ligne)
{
int i;
int Code=0;
for (i=0;i< strlen(ligne);i++)
Code=ligne[i]+31*Code;
return Code%101;
}
unsigned int ChercherMotDansTableHash(Liste **TableHash,char *mot){
Liste *p;
unsigned int cle;
cle = HashCode(mot);
for(p=TableHash[cle];p!=NULL;p=p->suivant)
if(strcmp(p->m->mot,mot)==0)
return 1;
return 0;
}
mots *InsertionEnTeteMot(mots *m,char mot[50]){
mots *nouveau;
nouveau = (mots *) malloc (sizeof(mots));
strcpy(nouveau->mot,mot);
nouveau->suivant = m;
return nouveau;
}
Liste *InsertionEnTete(Liste *L,char *mot){
Liste *nouveau;
nouveau = (Liste *) malloc (sizeof(Liste));
nouveau->freq=0;
nouveau->m=NULL;
nouveau->m=InsertionEnTeteMot(nouveau->m,mot);
//nouveau->m = InsertionEnQueueMot(nouveau->m,mot);
nouveau->suivant = L;
nouveau->c = NULL;
return nouveau;
} |
et ca le header
Code:
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 71
| #ifndef TABLE_HASH
#define TABLE_HASH
typedef struct c{
int pos;
int nl;
struct c *suivant;
}Coordonnees;
typedef struct L{
char mot[50];
Coordonnees *c;
struct L *suivant;
}Liste1;
typedef struct m{
char mot[50];
struct m *suivant;
}mots;
typedef struct L2{
int freq;
mots *m;
Coordonnees *c;
struct L2 *suivant;
}Liste;
int nb_lignes (FILE *fp)
{
int n=0;
char c;
while ((c = fgetc(fp)) != EOF)
{
if (c == '\n')
{
n++;
}
}
return n;
}
Liste *InsertionEnTete(Liste *L,char *mot);
Coordonnees *InsertionEnTeteCoordonnee(Coordonnees *C,int nl,int pos);
mots *InsertionEnTeteMot(mots *m,char mot[50]);
void AfficherListe(Liste *L);
void AfficherCoordonnees(Coordonnees *C);
void AfficheMot(mots *mot);
char *dernierMot(Liste *p);
unsigned int HashCode (char *ligne);
void AfficherTableHash(Liste **TableHash);
unsigned int ChercherMotDansTableHash(Liste **TableHash,char *mot);
void PosLigne(FILE *F,Liste **TableHash);
void frequent( Liste **TableHash , int mc);
void ParcourirElementTableHash(Liste **TableHash,char *mot);
void FiltreListe(Liste **L, int seuil);
void Generer2seq(Liste **TableHash, int seuil, Liste **seq);
Liste * GenererNseq(Liste **TableHash, int seuil,Liste **se, Liste **seq);
void GenRA(Liste * l, Liste **TableHash);
void elagage(Liste *t, Liste **s);
int calculFrequence(Liste **TableHash, char mot[50]);
Liste* supprimerElement(Liste* liste, Liste* sup);
void Verifier(Liste **L);
int MaxPos(Liste **TableHash,char mot[50],int ligne);
Coordonnees* supprimerCooredonnees(Coordonnees* liste, Coordonnees* sup) ;
mots *InsertionEnQueueMot(mots *m,char mot[50]);
void rassembler (Liste** L);
#endif |
J'attends vos réponses
merci
PS: je programme sous dev c++ et sous win XP