Bonjour,
j'essaie de me familiariser avec les vpath avant d'entamer un projet..
J'utilise cygwin, voici mon makefile :
CC=gcc
CFLAGS=-W -Wall -ansi -pedantic
LDFLAGS=
vpath %.h helloh
EXEC=hello
all: $(EXEC)
hello: hello.o main.o
$(CC) -o hello hello.o main.o $(LDFLAGS)
hello.o: hello.c
$(CC) -o hello.o -c hello.c $(CFLAGS)
main.o: main.c hello.h
$(CC) -o main.o -c main.c $(CFLAGS)
clean:
rm -rf *.o
mrproper: clean
rm -rf $(EXEC)
Mon hello.h est situé dans le dossier helloh (C:\temp\helloworld\helloh\hello.h)
Les fichier hello.c et main.c et Makefile sont dans le dossier helloworld
dans cygwin :
$ make
gcc -o hello.o -c hello.c -W -Wall -ansi -pedantic
gcc -o main.o -c main.c -W -Wall -ansi -pedantic
main.c:3:19: hello.h: No such file or directory
main.c: In function 'main':
main.c:7: warning: impicit declaration of function 'hello'
make: *** [main.o] Error 1
main.c:
Il ne trouve donc pas le fichier hello.h...
Sachant qu'il n'y a aucun probleme quand je met tout dans le même fichier sans le vpath.
J'ai essayé beaucoup de chose et je ne comprends pas. Si quelqu'un pouvait m'aider. Merci beaucoup





Répondre avec citation
Partager