In my code (using code blocks) it kept saying multiple definition in every function in wagon.c
I try change so much var in .h and main but it useless. I'm not that good in English nor in code ^^ so please any help or some sites to learn this chapter to improve my skills.
I have the .h and its good
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "wagon.h"
void saisir_wagon(wagon *w) //here there is a multipel definition how``
{
printf("donner un numero\n");
scanf("%d", &w->num);
do {
printf("donner le type\n");
gets(w->type);
} while ((strcmp(w->type, "wagon") != 0)
&& (strcmp(w->type, "locomotive" != 0)));
do {
printf("donner l etat \n");
scanf("%d", &w->ok);
} while ((w->ok = !0) && (w->ok = !1));
}
LIST ajout_deb(wagon w, LIST l) {
struct cellule *nouv;
nouv = malloc(sizeof(wagon));
if (l != NULL) {
nouv->w = w;
nouv->suiv = l;
} else {
nouv->suiv = NULL;
l = nouv;
}
return l;
}
LIST ajout_queue(wagon W, LIST l) {
struct cellule *nouv, *parc;
nouv = malloc(sizeof(cellule));
nouv->w = W;
nouv->suiv = NULL;
if (l == NULL) {
l = nouv;
} else {
parc = l;
while (parc->suiv != NULL) {
parc = parc->suiv;
}
parc->suiv = nouv;
}
return (l);
}
void parkour_l(LIST l) {
struct cellule *tmp = l;
if (l == NULL)
printf("liste vide /n");
else {
while (tmp != NULL) {
printf("le numero :%d /n", tmp->w.num);
printf("le type :%s /n", tmp->w.type);
printf("l'etat: %d /n", tmp->w.ok);
tmp = tmp->suiv;
}
}
}