I try to compile a c++ code with the library SDL2 at school in debian x32 but I got few error:
main.cpp:(.text+0x39): undefined reference to `SDL_CreateWindow'
main.cpp:(.text+0x59): undefined reference to `SDL_CreateRenderer'
main.cpp:(.text+0x69): undefined reference to `SDL_RenderPresent'
main.cpp:(.text+0x75): undefined reference to `SDL_Delay'
collect2: error: ld returned 1 exit status
- Code: Select all
screen = SDL_CreateWindow("test", SDL_WINDOWPOS_CENTERED, 20, 500, 300, SDL_WINDOW_SHOWN);
renderer = SDL_CreateRenderer(screen, -1, SDL_RENDERER_PRESENTVSYNC);
In terminal, I write:
g++ main.cpp -L. -lSDL2 -lSDL2main
In the same folder I have:
- A folder "SDL2" with all .h file
I already tried to replace the include by #include <SDL2/SDL.h> and write in the console:
g++ main.cpp -I(PATH TO MY INCLUDE FILES ON USB KEY) -L(PATH TO MY .a FILES AND .lib FILES ON USB KEY) -lSDL2 -lSDL2main
but I had the same thing.
Because I am at school, I don't have root permission so I can't install anything.
In my own computer on windows or debian it work perfectly.