Problème avec la compilation d'un fichier en SDL

Fermé
RiNoXuS Messages postés 1 Date d'inscription jeudi 7 mai 2015 Statut Membre Dernière intervention 7 mai 2015 - Modifié par RiNoXuS le 7/05/2015 à 23:12
kharchafi Messages postés 9 Date d'inscription jeudi 14 mai 2015 Statut Membre Dernière intervention 18 mai 2015 - 14 mai 2015 à 22:58
Bonjour,

Je suis débutant en programmation enfin j'ai quand même certaine base
surtout dans les applications dans un cmd.
Donc voilà mon problème, j'ai cherché a installer la SDL sur mon logiciel IDE (Code::block) jusque la tous se passe bien.
Après je vais cherchez un code source pour verifié que mon installation a bien fonctionné (Je suis allez voir sur OpenClassroom ).
Et mon problème vient justement la.
il ne me le compile pas, après j'ai déjà eu un soucis avec le compiler qui etait MinGW, c'est pour sa que j'ai du installer Borland c++.

Enfin bref voilà mes erreurs :

bcc32.exe -q -w -v -I"C:\Program Files (x86)\CodeBlocks\SDL-1.2.15\include" -IC:\Borland\BCC55\include -oobj\Debug\main.obj -c main.c
main.c:
Error E2176 C:\Program Files (x86)\CodeBlocks\SDL-1.2.15\include \SDL/SDL_config_win32.h 62: Too many types in declaration
Error E2176 C:\Program Files (x86)\CodeBlocks\SDL-1.2.15\include\SDL/SDL_config_win32.h 63: Too many types in declaration
Error E2021 C:\Program Files (x86)\CodeBlocks\SDL-1.2.15\include\SDL/SDL_stdinc.h 130: Array must have at least one element
Error E2021 C:\Program Files (x86)\CodeBlocks\SDL-1.2.15\include\SDL/SDL_stdinc.h 131: Array must have at least one element
Warning W8055 C:\Program Files (x86)\CodeBlocks\SDL-1.2.15\include\SDL/SDL_endian.h 162: Possible overflow in shift operation in function SDL_Swap64

Warning W8055 C:\Program Files (x86)\CodeBlocks\SDL-1.2.15\include\SDL/SDL_endian.h 165: Possible overflow in shift operation in function SDL_Swap64
Warning W8057 main.c 17: Parameter 'argc' is never used in function SDL_main
Warning W8057 main.c 17: Parameter 'argv' is never used in function SDL_main

Merci de vos réponses par avances .
A voir également:

1 réponse

kharchafi Messages postés 9 Date d'inscription jeudi 14 mai 2015 Statut Membre Dernière intervention 18 mai 2015
14 mai 2015 à 22:58
Bonjour,
Vous trouverez ci-dessous les étapes à suivre pour configurer SDL2 Sous CodeBlocks :
  • Télécharger le fichier « SDL2-devel-2.0.3-mingw.tar.gz (MinGW 32/64-bit) » via le site « https://www.libsdl.org/ »
  • Décompresser ce fichier.
  • Copiez les fichiers ayant l'extension « .a » du dossier décompressé « SDL2-devel-2.0.3-mingw\SDL2-2.0.3\i686-w64-mingw32\lib » dans le dossier « \CodeBlocks\MinGW\lib »
  • Copiez le fichier « SDL2.dll » du dossier « SDL2-devel-2.0.3-mingw \SDL2-2.0.3\i686-w64-mingw32\bin » dans le dossier « \CodeBlocks\MinGW\bin »
  • Créer un dossier nommé «SDL2» dans le dossier « \CodeBlocks\MinGW\include»
  • Copiez ensuite le contenu du dossier « SDL2-devel-2.0.3-mingw \SDL2-2.0.3\i686-w64-mingw32\include\SDL2 » dans le « \CodeBlocks\MinGW\include\SDL2»
  • Copiez le fichier «C:\Program Files (x86)\Windows Kits\8.1\Include\shared\winapifamily.h» dans le dossier «\CodeBlocks\MinGW\include»
  • Sous CodeBlocks, cliquer sur le menu «Settings -> Compiler...» puis l'onglet « Linker settings -> Other linker options » et ajouter «-lmingw32 -lSDL2main -lSDL2»
  • Créer un nouveau projet (File-> new ->Project, puis Console application etc.)
  • Remplacer le code du fichier source main.c par :

#include<stdio.h>
#include<stdlib.h>
#include<SDL2\sdl.h>

int main(int argc, char* argv[])
{
int quit=0;
SDL_Window *window;

// Initialise le sous-systeme video
if (SDL_Init(SDL_INIT_VIDEO)) {
fprintf(stderr, "Impossible d'initialiser SDL: %s\n", SDL_GetError());
exit(-1);
}

// Create an application window with the following settings:
window = SDL_CreateWindow(
"Test SDL2", // window title
SDL_WINDOWPOS_UNDEFINED, // initial x position
SDL_WINDOWPOS_UNDEFINED, // initial y position
640, // width, in pixels
480, // height, in pixels
SDL_WINDOW_RESIZABLE // flags
);

SDL_Event event;
while(!quit) {
SDL_WaitEvent(&event);
if(event.type==SDL_QUIT) quit=1; // SDL_QUIt : la croix en haut à droite
}

// Close and destroy the window
SDL_DestroyWindow(window);

// Clean up
SDL_Quit();

return 0;
}
  • Si voulez-vous lancer le fichier exécutable, il faut copier le fichier SDL2.dll dans le dossier où se trouve le .exe.
0