Bug de SDL2

Fabio -  
 Fabio -
J'essaye de faire fonctionner une base de code de SDL2, mais le compilateur me dit que les fonctions n'existe pas alors que l'IDE me les propose et qu'elle sont dans SDL (j'ai pu remonter jusqu'à leur déclaration).
Pour info je suis sous Code::Blocks.
Mon code :
#include <stdlib.h>

#include <stdio.h>

#include <SDL2/SDL.h>

int main(int argc, char *argv[])

{

    SDL_Surface *ecran = NULL;
    SDL_Init(SDL_INIT_VIDEO);


    ecran = SDL_SetVideoMode(640, 256, 32, SDL_HWSURFACE);


    SDL_Quit();


    return EXIT_SUCCESS;

}


Compilateur :
g++ -Wall -g  -c /home/fabio/Documents/C/Boxing/main.cpp -o obj/Debug/main.o
/home/fabio/Documents/C/Boxing/main.cpp: In function ‘int main(int, char**)’:
/home/fabio/Documents/C/Boxing/main.cpp:15:44: error: ‘SDL_HWSURFACE’ was not declared in this scope
     ecran = SDL_SetVideoMode(640, 256, 32, SDL_HWSURFACE);
                                            ^
/home/fabio/Documents/C/Boxing/main.cpp:15:57: error: ‘SDL_SetVideoMode’ was not declared in this scope
     ecran = SDL_SetVideoMode(640, 256, 32, SDL_HWSURFACE);
                                                         ^
Process terminated with status 1 (0 minute(s), 0 second(s))
2 error(s), 0 warning(s) (0 minute(s), 0 second(s))
 

2 réponses

[Dal] Messages postés 6205 Date d'inscription   Statut Contributeur Dernière intervention   1 105
 
Salut Fabio,

Ce n'est pas un "bug" de SLD2.

Ton code est pour SDL 1.2.

Utilise SDL_CreateWindow() au lieu de SDL_SetVideoMode

Vois https://wiki.libsdl.org/MigrationGuide pour adapter ton code existant, ou prend des bases de code pour SDL2.


Dal
0
Fabio
 
Justement, mon IDE me propose cette fonction, c'est ça qui m'intrigue, mais je vais regarder ton lien, merci
0