Closed peiworld closed 11 years ago
Also, -lm might be needed for the LDFLAGS.
this has been fixed with Janusz' patches. I didn't include -lm though because it works for me without it. Thanks for reporting!
I need -lm
too on x86_64 arch.
ok, i've added -lm to linker flags
If the library is before the -o, then it will fail as below:
gcc -lSDL -lSDL_ttf -o fft_eval fft_eval.o fft_eval.o: In function
graphics_init_sdl': fft_eval.c:(.text+0xc): undefined reference to
SDL_Init' fft_eval.c:(.text+0x19): undefined reference toSDL_GetVideoInfo' fft_eval.c:(.text+0x53): undefined reference to
SDL_WM_SetCaption' fft_eval.c:(.text+0x73): undefined reference toSDL_SetVideoMode' fft_eval.c:(.text+0x7d): undefined reference to
TTF_Init' fft_eval.c:(.text+0x95): undefined reference toTTF_OpenFont' fft_eval.o: In function
render_text': fft_eval.c:(.text+0x34d): undefined reference toTTF_RenderText_Solid' fft_eval.c:(.text+0x373): undefined reference to
SDL_UpperBlit' fft_eval.c:(.text+0x37b): undefined reference toSDL_FreeSurface' fft_eval.o: In function
draw_picture': fft_eval.c:(.text+0x3f7): undefined reference toSDL_CreateRGBSurface' fft_eval.c:(.text+0x695): undefined reference to
log10f' fft_eval.c:(.text+0x6a5): undefined reference tolog10f' fft_eval.c:(.text+0x75c): undefined reference to
SDL_UpperBlit' fft_eval.c:(.text+0x768): undefined reference toSDL_FreeSurface' fft_eval.c:(.text+0x775): undefined reference to
SDL_Flip' fft_eval.o: In functiongraphics_main': fft_eval.c:(.text+0xac2): undefined reference to
SDL_EnableKeyRepeat' fft_eval.c:(.text+0xb1c): undefined reference toSDL_PollEvent' fft_eval.c:(.text+0xb91): undefined reference to
SDL_WaitEvent' fft_eval.c:(.text+0xbca): undefined reference toSDL_Quit' fft_eval.o: In function
graphics_quit_sdl': fft_eval.c:(.text+0x171): undefined reference to `SDL_Quit' collect2: ld returned 1 exit status make: *\ [fft_eval] Error 1have to change the library order to $(LD) -o $@ $(OBJ) $(LIBS) in the Makefile, and it works