bonsoir a tous,

alors voila je me suis fais une petite librairie statique mais en voulant tester les includes dans une simple programme il m' affiche des erreurs a la compilation:

mais avant voici les divers manipes que j'ai fait:

mon make
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
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
.SILENT:
 
SERVEUR = ./Serveur
CLIENT = ./Client
FONCTION = ./fonctionPartagee
OUT = ./out
OBJ = $(SERVEUR)/socketSer.o $(CLIENT)/socketCli.o $(FONCTION)/fonctionPartagee.o
CC = cc -I$(OUT) -I$(SERVEUR) -I$(CLIENT) -I$(FONCTION)
LIB = $(OUT)/socketSer.o $(OUT)/socketCli.o $(OUT)/fonctionPartagee.o
 
 
all: $(LIB)
 
$(OUT)/socketSer.o:	$(SERVEUR)/socketSer.h $(SERVEUR)/socketSer.c $(OUT)/fonctionPartagee.o
	echo Compilation de socketSer.o
	$(CC) -c $(SERVEUR)/socketSer.h $(SERVEUR)/socketSer.c $(OUT)/fonctionPartagee.o
	mv socketSer.o $(OUT)
 
$(OUT)/socketCli.o:	$(CLIENT)/socketCli.h $(CLIENT)/socketCli.c $(OUT)/fonctionPartagee.o
	echo Compilation de socketCli.o
	$(CC) -c $(CLIENT)/socketCli.h $(CLIENT)/socketCli.c $(OUT)/fonctionPartagee.o
	mv socketCli.o $(OUT)
 
$(OUT)/fonctionPartagee.o:	$(FONCTION)/fonctionPartagee.h $(FONCTION)/fonctionPartagee.c
	echo Compilation de fonctionPartagee.o
	$(CC) -c $(FONCTION)/fonctionPartagee.h $(FONCTION)/fonctionPartagee.c
	mv fonctionPartagee.o $(OUT)
clean:
	@rm -f $(SERVEUR)/*.o
	@rm -f $(SERVEUR)/*.*~
	@rm -f $(SERVEUR)/*~
	@rm -f $(SERVEUR)/*.gch
	@rm -f $(CLIENT)/*.o
	@rm -f $(CLIENT)/*.*~
	@rm -f $(CLIENT)/*~
	@rm -f $(CLIENT)/*.gch
	@rm -f $(FONCTION)/*.o
	@rm -f $(FONCTION)/*.*~
	@rm -f $(FONCTION)/*~
	@rm -f $(FONCTION)/*.gch
	@rm -f $(OUT)/*.o
	@rm -f $(OUT)/*.*~
	@rm -f $(OUT)/*~
	@rm -f $(OUT)/*.gch
lib:
 
	@ar -rcsv libmySocket.a $(OUT)/socketSer.o $(OUT)/socketCli.o $(OUT)/fonctionPartagee.o
le resultat du make :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
Compilation de fonctionPartagee.o
./fonctionPartagee/fonctionPartagee.c: In function ‘getMessage’:
./fonctionPartagee/fonctionPartagee.c:26: warning: incompatible implicit declaration of built-in function ‘memset’
Compilation de socketSer.o
cc: ./out/fonctionPartagee.o: linker input file unused because linking not done
Compilation de socketCli.o
cc: ./out/fonctionPartagee.o: linker input file unused because linking not done
ensuite j 'ai cree l'archive grace a make lib:

ensuite mon prog de teste:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
#include"socketSer.h"
int main(){
	printf("ok");
return 1;
}
a la compile:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
gcc t.c -static -L. -lmySocket
t.c:1:22: error: socketSer.h: Aucun fichier ou dossier de ce type
t.c: In function ‘main’:
t.c:3: warning: incompatible implicit declaration of built-in functionprintf
voici le tree de mes repertoire :
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
21
22
23
24
 
.
|-- Client
|   |-- socketCli.c
|   |-- socketCli.h
|   `-- socketCli.h.gch
|-- Serveur
|   |-- socketSer.c
|   |-- socketSer.h
|   `-- socketSer.h.gch
|-- fonctionPartagee
|   |-- fonctionPartagee.c
|   |-- fonctionPartagee.h
|   `-- fonctionPartagee.h.gch
|-- fonctionPartagee.c~
|-- libmySocket.a
|-- makefile
|-- makefile~
|-- out
|   |-- fonctionPartagee.o
|   |-- socketCli.o
|   `-- socketSer.o
|-- t.c
`-- t.c~