Bonjour,
j'ai installé SDL2 sur debian:
mais j'ai reference indefinie pour toutes les fonctions SDL2.
Code : Sélectionner tout - Visualiser dans une fenêtre à part $ sudo apt install libsdl2-dev libsdl2-2.0-0
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14 g++ -lSDL2 -lSDL2main *cpp /usr/bin/ld*: /tmp/ccnas9p7.o*: dans la fonction «*main*»*: main.cpp:(.text+0x15)*: référence indéfinie vers «*SDL_Init*» /usr/bin/ld*: main.cpp:(.text+0x21)*: référence indéfinie vers «*SDL_GetError*» /usr/bin/ld*: main.cpp:(.text+0x3d)*: référence indéfinie vers «*SDL_LogError*» /usr/bin/ld*: main.cpp:(.text+0x79)*: référence indéfinie vers «*SDL_CreateWindowAndRenderer*» /usr/bin/ld*: main.cpp:(.text+0x85)*: référence indéfinie vers «*SDL_GetError*» /usr/bin/ld*: main.cpp:(.text+0xa1)*: référence indéfinie vers «*SDL_LogError*» /usr/bin/ld*: main.cpp:(.text+0xa6)*: référence indéfinie vers «*SDL_Quit*» /usr/bin/ld*: main.cpp:(.text+0xce)*: référence indéfinie vers «*SDL_PollEvent*» /usr/bin/ld*: main.cpp:(.text+0xe9)*: référence indéfinie vers «*SDL_DestroyRenderer*» /usr/bin/ld*: main.cpp:(.text+0xf5)*: référence indéfinie vers «*SDL_DestroyWindow*» /usr/bin/ld*: main.cpp:(.text+0xfa)*: référence indéfinie vers «*SDL_Quit*» collect2: error: ld returned 1 exit statusquelqu'un a une idée?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31 //main.cpp #include <SDL2/SDL.h> #include "classesEtConstantes.hpp" int main(int argc,char *argv[]){ if (SDL_Init(SDL_INIT_VIDEO) < 0){ SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "[DEBUG] > %s", SDL_GetError()); return -1; } SDL_Window* pWindow{ nullptr }; SDL_Renderer* pRenderer{ nullptr }; if (SDL_CreateWindowAndRenderer(800, 600, SDL_WINDOW_SHOWN, &pWindow, &pRenderer) < 0){ SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "[DEBUG] > %s", SDL_GetError()); SDL_Quit(); return -1; } SDL_Event events; bool isOpen{ true }; while (isOpen){ while (SDL_PollEvent(&events)){ switch (events.type){ case SDL_QUIT: isOpen = false; break; } } } SDL_DestroyRenderer(pRenderer);SDL_DestroyWindow(pWindow); SDL_Quit(); return 0; }
Partager