Bonsoir,
Je ne sais pas si je suis au bon endroit pour poser ma question.
je commence dans la programmation en C/C++
je suis en train de suivre les cours de programmation de la GBA: http://gfx.developpez.com/prog-gba
au lieu d'utiliser devkitadvance , j'utilise devkitpro
pour le premier cours en modifiant le makefile:
puisque j'arrive à le compiler
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 # # Makefile for main.gba # PATH := $(DEVKITARM)/bin:$(PATH) # --- Project details ------------------------------------------------- PROJ := main TARGET := $(PROJ) OBJS := $(PROJ).o # --- Build defines --------------------------------------------------- PREFIX := arm-none-eabi- CC := $(PREFIX)gcc LD := $(PREFIX)gcc OBJCOPY := $(PREFIX)objcopy ARCH := -mthumb-interwork -mthumb SPECS := -specs=gba.specs CFLAGS := $(ARCH) -O2 -Wall -fno-strict-aliasing LDFLAGS := $(ARCH) $(SPECS) .PHONY : build clean # --- Build ----------------------------------------------------------- # Build process starts here! build: $(TARGET).gba # Strip and fix header (step 3,4) $(TARGET).gba : $(TARGET).elf $(OBJCOPY) -v -O binary $< $@ -@gbafix $@ # Link (step 2) $(TARGET).elf : $(OBJS) $(LD) $^ $(LDFLAGS) -o $@ # Compile (step 1) $(OBJS) : %.o : %.cpp $(CC) -c $< $(CFLAGS) -o $@ # --- Clean ----------------------------------------------------------- clean : @rm -fv *.gba @rm -fv *.elf @rm -fv *.o #EOF
pour le cours 2 avec le meme makefile:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6 arm-none-eabi-gcc -c main.cpp -mthumb-interwork -mthumb -O2 -Wall -fno-strict-aliasing -o main.o arm-none-eabi-gcc main.o -mthumb-interwork -mthumb -specs=gba.specs -o main.elf arm-none-eabi-objcopy -v -O binary main.elf main.gba copy from `main.elf' [elf32-littlearm] to `main.gba' [binary] ROM fixed!
dans main.cpp en modifiant(sinon je ne pouvvais pas compiler):
le programme compile bien malgre des warning:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13 void flipBuffers() { if (*mode & BACKBUFFER) { *mode &= ~BACKBUFFER; videoBackBuffer; } else { *mode |= BACKBUFFER; videoFrontBuffer; } } // fin flipBuffers()
pour le cours 3 (compilation impossible) avec le makefile:
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 arm-none-eabi-gcc -c main.cpp -mthumb-interwork -mthumb -O2 -Wall -fno-strict-aliasing -o main.o main.cpp: In function 'void flipBuffers()': main.cpp:17:31: warning: statement has no effect [-Wunused-value] #define videoBackBuffer (u16*) 0x600A000 ^~~~~~~~~~~~~~~~ main.cpp:95:5: note: in expansion of macro 'videoBackBuffer' videoBackBuffer; ^~~~~~~~~~~~~~~ main.cpp:16:31: warning: statement has no effect [-Wunused-value] #define videoFrontBuffer (u16*) 0x6000000 ^~~~~~~~~~~~~~~~ main.cpp:98:5: note: in expansion of macro 'videoFrontBuffer' videoFrontBuffer; ^~~~~~~~~~~~~~~~ arm-none-eabi-gcc main.o -mthumb-interwork -mthumb -specs=gba.specs -o main.elf arm-none-eabi-objcopy -v -O binary main.elf main.gba copy from `main.elf' [elf32-littlearm] to `main.gba' [binary] ROM fixed!
sortie compilation
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72 # # cours3 # PATH := $(DEVKITARM)/bin:$(PATH) # --- Project details ------------------------------------------------- PROJ := main TITLE := $(PROJ) COBJS := $(PROJ).o fastrandom.o OBJS := $(COBJS) # --- boot type (MB=0 : normal. MB=1 : multiboot) --- MB = 0 ifeq ($(MB),1) TARGET := $(PROJ).mb SPECS := -specs=gba_mb.specs else TARGET := $(PROJ) SPECS := -specs=gba.specs endif # --- Compiling ------------------------------------------------------- CROSS ?= arm-none-eabi- AS := $(CROSS)as CC := $(CROSS)gcc LD := $(CROSS)gcc OBJCOPY := $(CROSS)objcopy ARCH := -mthumb-interwork -mthumb ASFLAGS := -mthumb-interwork CFLAGS := $(ARCH) -O2 -Wall -fno-strict-aliasing LDFLAGS := $(ARCH) $(SPECS) .PHONY : build clean # --- Build ----------------------------------------------------------- build : $(TARGET).gba $(TARGET).gba : $(TARGET).elf $(OBJCOPY) -v -O binary $< $@ -@gbafix $@ -t$(TITLE) $(TARGET).elf : $(OBJS) $(LD) $^ $(LDFLAGS) -o $@ $(COBJS) : %.o : %.cpp $(CC) $(CFLAGS) -c $< -o $@ # --- Clean ----------------------------------------------------------- clean : @rm -fv *.gba @rm -fv *.elf @rm -fv *.o #EOF
je ne comprends pas ces erreurs.
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 arm-none-eabi-gcc main.o fastrandom.o -mthumb-interwork -mthumb -specs=gba.specs -o main.elf /home/name/devkit/devkitARM/lib/gcc/arm-none-eabi/8.2.0/../../../../arm-none-eabi/bin/ld: main.o: in function `bilinearInterpolation(grid2d*)': main.cpp:(.text+0xb4): undefined reference to `operator new[](unsigned int)' /home/name/devkit/devkitARM/lib/gcc/arm-none-eabi/8.2.0/../../../../arm-none-eabi/bin/ld: main.cpp:(.text+0x10a): undefined reference to `operator delete[](void*)' /home/name/devkit/devkitARM/lib/gcc/arm-none-eabi/8.2.0/../../../../arm-none-eabi/bin/ld: main.o: in function `freeGrid(grid2d*)': main.cpp:(.text+0x334): undefined reference to `operator delete[](void*)' /home/name/devkit/devkitARM/lib/gcc/arm-none-eabi/8.2.0/../../../../arm-none-eabi/bin/ld: main.o: in function `initGrid(int, int)': main.cpp:(.text+0x348): undefined reference to `operator new(unsigned int)' /home/name/devkit/devkitARM/lib/gcc/arm-none-eabi/8.2.0/../../../../arm-none-eabi/bin/ld: main.cpp:(.text+0x356): undefined reference to `operator new[](unsigned int)' /home/name/devkit/devkitARM/lib/gcc/arm-none-eabi/8.2.0/../../../../arm-none-eabi/bin/ld: main.o: in function `createPlasma(int, double, double)': main.cpp:(.text+0x416): undefined reference to `pow' /home/name/devkit/devkitARM/lib/gcc/arm-none-eabi/8.2.0/../../../../arm-none-eabi/bin/ld: main.o: in function `main': main.cpp:(.text.startup+0x80): undefined reference to `operator delete[](void*)' /home/name/devkit/devkitARM/lib/gcc/arm-none-eabi/8.2.0/../../../../arm-none-eabi/bin/ld: main.cpp:(.text.startup+0x88): undefined reference to `operator delete(void*, unsigned int)' collect2: error: ld returned 1 exit status Makefile:59: recipe for target 'main.elf' failed make: *** [main.elf] Error 1
Merci de votre aide
ps: j'avais voulu aussi essayer
https://github.com/uli/dragonbasic sous linux
dans le dossier examples quand je fais un make, voici le message:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5 cd breakout; ../../dbc -sym breakout.dbc breakout.gba Segmentation fault (core dumped) Makefile:26: recipe for target 'breakout/breakout.gba' failed make: *** [breakout/breakout.gba] Error 139
Partager