problems using SDL2 for AOS 4
Closed this issue · 10 comments
Good morning
I'm sorry to bother you but I'm new to Amiga OS 4 and for a week I've been trying to compile an SDL2 program under Cubic but I can't do it.
I think the problem comes from my makefile
`
EXE = bin/gcc-amigaos4-latest/SDL2
OBJDIR = o/gcc-amigaos4-latest/
SDK_PATH = SDK:local/newlib/
CC = gcc
CXXFLAGS= -Wall -O2 -I$(SDK_PATH)/include -I$(SDK_PATH)/include/SDL2
all : $(EXE)
$(OBJDIR)main.o : main.c
OBJS = $(OBJDIR)main.o
strip:
strip --remove-section=.comment $(EXE)
clean:
-delete $(EXE)
-delete $(OBJDIR)*.o
`
what is the error message?
gcc -Wall -O2 -ISDK:local/newlib//include -ISDK:local/newlib//include/SDL2 o/gcc-amigaos4-latest/main.o -lauto -o bin/gcc-amigaos4-latest/SDL2
o/gcc-amigaos4-latest/main.o: In function main': main.c:(.text+0x24): undefined reference to
SDL_Init'
main.c:(.text+0x68): undefined reference to SDL_CreateWindow' main.c:(.text+0xa0): undefined reference to
SDL_CreateRenderer'
main.c:(.text+0xd4): undefined reference to SDL_PollEvent' main.c:(.text+0x104): undefined reference to
SDL_RenderClear'
main.c:(.text+0x10c): undefined reference to SDL_RenderPresent' main.c:(.text+0x124): undefined reference to
SDL_DestroyRenderer'
main.c:(.text+0x12c): undefined reference to SDL_DestroyWindow' main.c:(.text+0x130): undefined reference to
SDL_Quit'
make: *** [bin/gcc-amigaos4-latest/SDL2] Error 1
Done.
for information, my code works well under windows
It's under Amiga OS that I can't compile
Thanks for the help
there is a double slash // on both 8f your includes, the include dirs aren't probably picked up because of it
I corrected the problem unfortunately it does not come from there
gcc -Wall -O2 -ISDK:local/newlib/include -ISDK:local/newlib/include/SDL2 o/gcc-amigaos4-latest/main.o -lauto -o bin/gcc-amigaos4-latest/SDL2
o/gcc-amigaos4-latest/main.o: In function main': main.c:(.text+0x24): undefined reference to
SDL_Init'
main.c:(.text+0x68): undefined reference to SDL_CreateWindow' main.c:(.text+0xa0): undefined reference to
SDL_CreateRenderer'
main.c:(.text+0xd4): undefined reference to SDL_PollEvent' main.c:(.text+0x104): undefined reference to
SDL_RenderClear'
main.c:(.text+0x10c): undefined reference to SDL_RenderPresent' main.c:(.text+0x124): undefined reference to
SDL_DestroyRenderer'
main.c:(.text+0x12c): undefined reference to SDL_DestroyWindow' main.c:(.text+0x130): undefined reference to
SDL_Quit'
make: *** [bin/gcc-amigaos4-latest/SDL2] Error 1
Done.
try with
-lSDL2main -lSDL2
before
-lauto
gcc -Wall -O2 -ISDK:local/newlib/include -ISDK:local/newlib/include/SDL2 o/gcc-amigaos4-latest/main.o -lSDL2 -lSDL2main -lauto -o bin/gcc-amigaos4-latest/SDL2
ld: cannot find -lSDL2main
make: *** [bin/gcc-amigaos4-latest/SDL2] Error 1
Done.
you should come to amigans.net, far more people there to help you, but it looks like your "$path" is incomplete.
getenv path
/SDK/c:/SDK/local/c:/SDK/local/newlib/bin:/usr/local/bin:/SDK/gcc/bin:/c:/SDK/c/cmake-3.7.1/bin
is what i have set
also check your amigaos path with simply
"path"
and see if it also points to sdk:local/newlib/...etc
oh...and try without -lSDL2main obviously :-)
it's good it works
thank you for your help
I post the clean makefile here
EXE = bin/gcc-amigaos4-latest/SDL2
OBJDIR = o/gcc-amigaos4-latest/
SDK_PATH = SDK:local/newlib/
CC = gcc
CXXFLAGS= -Wall -O2 -I$(SDK_PATH)include -I$(SDK_PATH)include/SDL2
all : $(EXE)
$(OBJDIR)main.o : main.c
OBJS = $(OBJDIR)main.o
strip:
strip --remove-section=.comment $(EXE)
clean:
-delete $(EXE)
-delete $(OBJDIR)*.o