I am working on this SDL project and so far everything was looking good until I added the SDL_tff library.
I made sure to add ...
- lib files (.a & .la files in /lib)
- the SDL_ttf.h header file
- the .dll in the build dir
- and added the -lSDL_tff flag to the linker
when I build with make
command, then is returns this error.
undefined reference to `TTF_RenderText_Solid'
undefined reference to `SDL_CreateTextureFromSurface'
undefined reference to `SDL_FreeSurface'
undefined reference to `SDL_Init'
undefined reference to `SDL_CreateWindowAndRenderer'
undefined reference to `TTF_Init'
undefined reference to `TTF_OpenFont'
undefined reference to `SDL_PollEvent'
undefined reference to `SDL_SetRenderDrawColor'
undefined reference to `SDL_RenderClear'
undefined reference to `SDL_RenderCopy'
undefined reference to `SDL_RenderCopy'
undefined reference to `SDL_RenderPresent'
undefined reference to `SDL_DestroyTexture'
undefined reference to `SDL_DestroyTexture'
undefined reference to `TTF_Quit'
undefined reference to `SDL_DestroyRenderer'
undefined reference to `SDL_DestroyWindow'
undefined reference to `SDL_Quit'
This is my make file
#OBJS specifies which files to compile as part of the project
OBJS = src/main.c
#CC specifies which compiler we're using
CC = gcc
#COMPILER_FLAGS specifies the additional compilation options we're using
# -w suppresses all warnings
COMPILER_FLAGS = -w
#LINKER_FLAGS specifies the libraries we're linking against
LINKER_FLAGS = -I./include -L./lib -Lmingw32 -LSDLmain -LSDL -lsdl2_ttf
#OBJ_NAME specifies the name of our exectuable
OBJ_NAME = main
#This is the target that compiles our executable
all : $(OBJS)
$(CC) $(COMPILER_FLAGS) $(LINKER_FLAGS) $(OBJS) -o build/$(OBJ_NAME)
I tried to the x64 and x86 versions of SDL_ttf and also I tried 10+ diffirent linker options.
EVERYTHING that I do ruins the project or makes it unworkable...