Bonjour,
Bon alors actuellement, nous sommes dans la réalisation d'un compilateur le projet avance pas mal jusqu'a cette grosse incompréhension:
j'appelle une fonction dans mon fichier main (dans une fonction nommée ajouter_element): add_in_R_Index
ce fichier main inclut bien main.h qui lui fera appel au table_representation dans lequel je déclare le prototype de mon add_in_R_Index.
main.h
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7 ~/Compi/Projet# gcc -Wall main.c table_lexicographique.o table_declaration.o table_representation.o Rlist.o DList.o Llist.o /tmp/ccmUiAih.o: In function `ajouter_element': main.c:(.text+0x3bc): undefined reference to `add_in_R_Index' collect2: ld returned 1 exit status
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7 #include "table_lexicographique.h" #include "table_declaration.h" #include "table_representation.h" int taille_tableau(int num_lex,Rlist l,DList d); int ajouter_element(H_Index* hashtable, R_Index Rtable, D_Index declar, Type what, char* lexeme,int type_var,int nb_param,...);
main.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 // Je ne met que la portion de fonction qui pose problème /* ajout de l'element dans la table des representations si c'est pas une variable */ if(what!=VARIABLE) { va_list ap; va_start(ap,nb_param); int* tab=(int*)malloc(sizeof(int)*nb_param); int i=0; for(;i<nb_param;i++) { tab[i]=va_arg(ap,int); } va_end(ap); represent* ajout = init_represent(what,num_lex,nb_param,tab); add_in_R_Index(ajout,Rtable); } /* fin ajout table des representation */
table_representation.h
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 #ifndef ALLINC #include <stdio.h> #include <stdlib.h> #include "central.h" #define ALLINC 0 #endif #include "Rlist.h" struct Rp_Index { Rlist first; }; typedef struct Rp_Index* R_Index; void add_in_R_Index(represent* rep, R_Index table); R_Index init_R_Index(); void affiche_R_Index(R_Index table);
table_representation.c
et excepté string.h et stdarg.h je n'utilise aucune librairie exotique =)
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 #include "table_representation.h" R_Index init_R_Index() { R_Index ind=(R_Index)malloc(sizeof(struct Rp_Index)); ind->first=init_Rlist(); return(ind); } void affiche_R_Index(R_Index table) { affiche_Rlist(table->first); } void add_in_R_index(represent* rep, R_Index table) { table->first=Radd(rep,table->first); }
Merci par avance a qui pourra nous aider a résoudre cette erreur... ( nous nous excusons par avance si c'est un erreur con... ^^' )
Partager