Bonjour,
je travaille sur un projet mixant fichiers C++ et C.
Compiler en ligne de commande ne me pose pas de problème:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
g++ -Wall -std=c++11 main.cpp gps.cpp led.cpp oled.cpp fontx.c client_http.cpp -lwiringPi
J'ai écrit un makefile pour me faciliter la vie:
Code Makefile : 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
CC=g++
CFLAGS=-Wall -std=c++11
LDFLAGS=-lwiringPi
EXEC=tracker
 
all: $(EXEC)
 
tracker: main.o client_http.o gps.o oled.o led.o fontx.o
	$(CC) $(CFLAGS) -o tracker main.o gps.o client_http.o oled.o led.o fontx.o $(LDFLAGS)
 
main.o: main.cpp
	$(CC) -o main.o -c main.cpp $(CFLAGS)
 
client_http.o: client_http.cpp
	$(CC) -o client_http.o -c client_http.cpp $(CFLAGS)
 
gps.o: gps.cpp
	$(CC) -o gps.o -c gps.cpp $(CFLAGS)
 
oled.o: oled.cpp fontx.h
	$(CC) -o oled.o -c oled.cpp $< $(CFLAGS)
 
led.o: led.cpp
	$(CC) -o led.o -c led.cpp $(CFLAGS)
 
fontx.o: fontx.c
	gcc -o fontx.o -c fontx.c -Wall
 
clean:
	rm -rf *.o
oled.cpp utilise des fonctions déclarées dans fontx.h, j'ai donc placé une dépendance à ce qui me semble être le bon endroit mais j'ai toujours des erreurs du genre:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
g++ -Wall -std=c++11 -o tracker main.o gps.o client_http.o oled.o led.o fontx.o -lwiringPi
oled.o*: Dans la fonction «*Oled::Oled(int)*»*:
oled.cpp:(.text+0x9c)*: référence indéfinie vers «*Fontx_init(FontxFile*, char const*, char const*)*»
oled.o*: Dans la fonction «*Oled::drawSJISChar(FontxFile*, int, int, unsigned short, unsigned char, unsigned char)*»*:
oled.cpp:(.text+0x20c)*: référence indéfinie vers «*GetFontx(FontxFile*, unsigned int, unsigned char*, unsigned char*, unsigned char*)
Je lis le tuto de GL mais je bloque...
Si quelqu'un a une idée.
Merci