0

I have an error with compiling my SDL2 project, written on C++!

Compilation:

g++ main.cpp -o main -lSSGL

Errors:

/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/8/../../../x86_64-linux-gnu/libSSGL.so: undefined reference to `SDL_RenderFillRectF'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/8/../../../x86_64-linux-gnu/libSSGL.so: undefined reference to `SDL_RenderDrawRectF'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/8/../../../x86_64-linux-gnu/libSSGL.so: undefined reference to `SDL_SetRenderDrawColor'
collect2: error: ld returned 1 exit status

Makefile:

CC = g++
CFLAGS = -std=c++14
LIBS = -lsdl2 \
       -lsdl2_ttf \
       -lsdl2_image \
       -lsdl2_mixer \
       `sdl2-config --cflags --libs`
CPP_FILES = *.cpp
WARRNINGS = -Wall -Werror
LIB = libSSGL.so
O_FILES = *.o
HPP_FILES = *.hpp
SSGL_PATH = /usr/include/SSGL
LIB_PATH = /usr/lib/x86_64-linux-gnu/

all:
    $(CC) -c $(CFLAGS)  $(WARRNINGS) $(CPP_FILES) $(LIBS)
    $(CC) -shared $(CFLAGS) $(O_FILES) -o $(LIB)

install:
    cp -r $(LIB)  $(LIB_PATH)
    mkdir /usr/include/SSGL
    cp -r $(HPP_FILES) $(SSGL_PATH)
    make clean

uninstall:
    rm -rf $(SSGL_PATH)
    rm -rf /usr/lib/x86_64-linux-gnu/$(LIB)

clean:
    rm -rf $(O_FILES) $(LIB)

All includes were detected in project files.

But I can't understand why I have these errors.

RedBull4
  • 1
  • 1
  • 2

0 Answers0