I have a problem linking this simple C program using this makefile. I have included the lib named anagrammes.h in my makefile but the error seems to come from exemple.c
makefile :
all: exemple
exemple: exemple.o
exemple.o: exemple.c anagrammes.h
gcc -o exemple.o -c exemple.c -Wall
clean:
rm -rf *.o
exemple.c :
#include <stdio.h>
#include <string.h>
#include <anagrammes.h>
int main(void)
{
int i;
char buf[]="chien";
printf("\n signature:\n");
printf("s(%s) = %s\n", buf, signature(buf));
printf("\n anagramme:\n");
anagramme(buf,0,strlen(buf));
printf("\n getNiemeP:\n");
for(i=1;i<=fact(strlen(buf));i++) {
printf("%d %s\n",i,getNiemeP(buf, i));
}
}
EDIT: Thanks everyone for helping me. Here is the error message that I've got :
Erreur:
exemple.c: In function ‘main’:
exemple.c:20:1: attention : contrôle a atteint la fin non void de la fonction [-Wreturn-type]
/tmp/ccPXm1wV.o: In function `main':
exemple.c:(.text+0x39): undefined reference to `signature'
exemple.c:(.text+0x98): undefined reference to `anagramme'
exemple.c:(.text+0xc2): undefined reference to `getNiemeP'
exemple.c:(.text+0x112): undefined reference to `fact'
collect2: ld a retourné 1 code d'état d'exécution
make: *** [exemple] Erreur 1
**I also have a static library named libannagrammes.a
How can I solve this ? Thanks.