Bonjour,
Après recherche sur le site j'en suis venu à trouver la SDL 1.2, des messages d'erreurs s'affichent dans l'ide lors de la compilation.
Le fichier téléchargé doit être prévu pour fonctionner en 32 bits alors que l'os dont je dispose est en 64 bits...
https://jeux.developpez.com/telechar...ur-Code-Blocks
le dossier a été décompressé à la racine du C et renommé en SDL-1.2.15
C:\SDL-1.2.15
Ci-dessous mon fichier .pro :
Code Qt-pro : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12 TEMPLATE = app CONFIG += console CONFIG -= app_bundle CONFIG -= qt INCLUDEPATH += "C:\\SDL-1.2.15\\include" LIBS += -L"C:\\SDL-1.2.15\\lib" -lSDL LIBS += -L"C:\\SDL-1.2.1\\lib" -lSDLmain SOURCES += \ main.c
Le main :
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
32
33
34
35
36 #include <stdio.h> #include <stdlib.h> #include <windows.h> // gestion des couleurs sous windows #include <SDL/SDL.h> void pause(void); int main() { SDL_Init(SDL_INIT_VIDEO); // Initialisation de la SDL SDL_SetVideoMode(640, 480, 32, SDL_HWSURFACE); // Ouverture de la fenêtre pause(); // Mise en pause du programme SDL_Quit(); // Arrêt de la SDL return EXIT_SUCCESS; // Fermeture du programme } void pause() { int continuer = 1; SDL_Event event; while (continuer) { SDL_WaitEvent(&event); switch(event.type) { case SDL_QUIT: continuer = 0; } } }
1er message d'erreur pointant à la ligne 15 dans le main :
2eme message d'erreur pointant à la ligne 57 :
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 20:11:33: Exécution des étapes pour le projet zzz_00_win_64... 20:11:33: Configuration inchangée, étape qmake sautée. 20:11:33: Débute : "C:\Qt\Tools\mingw730_64\bin\mingw32-make.exe" -j8 C:\Qt\5.13.1\mingw73_64\bin\qmake.exe -o Makefile "..\..\..\Apprentissage Langage C_2020.01.18_01\Projet_ZZZ_Temp_Qt Creator_win_64\zzz_00_win_64\zzz_00_win_64.pro" -spec win32-g++ "CONFIG+=debug" "CONFIG+=qml_debug" C:\Qt\5.13.1\mingw73_64\bin\qmake.exe -o Makefile "..\..\..\Apprentissage Langage C_2020.01.18_01\Projet_ZZZ_Temp_Qt Creator_win_64\zzz_00_win_64\zzz_00_win_64.pro" -spec win32-g++ "CONFIG+=debug" "CONFIG+=qml_debug" C:\Qt\5.13.1\mingw73_64\bin\qmake.exe -o Makefile "..\..\..\Apprentissage Langage C_2020.01.18_01\Projet_ZZZ_Temp_Qt Creator_win_64\zzz_00_win_64\zzz_00_win_64.pro" -spec win32-g++ "CONFIG+=debug" "CONFIG+=qml_debug" C:\Qt\5.13.1\mingw73_64\bin\qmake.exe -o Makefile "..\..\..\Apprentissage Langage C_2020.01.18_01\Projet_ZZZ_Temp_Qt Creator_win_64\zzz_00_win_64\zzz_00_win_64.pro" -spec win32-g++ "CONFIG+=debug" "CONFIG+=qml_debug" C:/Qt/Tools/mingw730_64/bin/mingw32-make -f Makefile.Debug mingw32-make[1]: Entering directory 'D:/UTILITAIRES programmation/Apprentissage Langage C_2020.01.07_01/Projet_ZZZ_Temp_Qt Creator_win_64/build-zzz_00_win_64-Desktop_Qt_5_13_1_MinGW_64_bit-Debug' gcc -c -fno-keep-inline-dllexport -g -Wall -W -Wextra -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_QML_DEBUG -I"..\..\..\Apprentissage Langage C_2020.01.18_01\Projet_ZZZ_Temp_Qt Creator_win_64\zzz_00_win_64" -I. -IC:\SDL-1.2.15\include -IC:\Qt\5.13.1\mingw73_64\mkspecs\win32-g++ -o debug\main.o "..\..\..\Apprentissage Langage C_2020.01.18_01\Projet_ZZZ_Temp_Qt Creator_win_64\zzz_00_win_64\main.c" ..\..\..\Apprentissage Langage C_2020.01.18_01\Projet_ZZZ_Temp_Qt Creator_win_64\zzz_00_win_64\main.c: In function 'SDL_main': ..\..\..\Apprentissage Langage C_2020.01.18_01\Projet_ZZZ_Temp_Qt Creator_win_64\zzz_00_win_64\main.c:18:1: error: number of arguments doesn't match prototype { ^ In file included from C:\SDL-1.2.15\include/SDL/SDL.h:30:0, from ..\..\..\Apprentissage Langage C_2020.01.18_01\Projet_ZZZ_Temp_Qt Creator_win_64\zzz_00_win_64\main.c:13: C:\SDL-1.2.15\include/SDL/SDL_main.h:57:22: error: prototype declaration extern C_LINKAGE int SDL_main(int argc, char *argv[]); ^~~~~~~~ mingw32-make[1]: *** [Makefile.Debug:128: debug/main.o] Error 1 mingw32-make[1]: Leaving directory 'D:/UTILITAIRES programmation/Apprentissage Langage C_2020.01.07_01/Projet_ZZZ_Temp_Qt Creator_win_64/build-zzz_00_win_64-Desktop_Qt_5_13_1_MinGW_64_bit-Debug' mingw32-make: *** [Makefile:38: debug] Error 2 20:11:36: Le processus "C:\Qt\Tools\mingw730_64\bin\mingw32-make.exe" s'est terminé avec le code 2. Erreur lors de la compilation/déploiement du projet zzz_00_win_64 (kit : Desktop Qt 5.13.1 MinGW 64-bit) When executing step "Make" 20:11:36: Temps écoulé : 00:03.
J'utilise La SDL 1.2 car le cour que je suis est élaboré avec cette version de la librairie.
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106 /* SDL - Simple DirectMedia Layer Copyright (C) 1997-2012 Sam Lantinga This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Sam Lantinga slouken@libsdl.org */ #ifndef _SDL_main_h #define _SDL_main_h #include "SDL_stdinc.h" /** @file SDL_main.h * Redefine main() on Win32 and MacOS so that it is called by winmain.c */ #if defined(__WIN32__) || \ (defined(__MWERKS__) && !defined(__BEOS__)) || \ defined(__MACOS__) || defined(__MACOSX__) || \ defined(__SYMBIAN32__) || defined(QWS) #ifdef __cplusplus #define C_LINKAGE "C" #else #define C_LINKAGE #endif /* __cplusplus */ /** The application's main() function must be called with C linkage, * and should be declared like this: * @code * #ifdef __cplusplus * extern "C" * #endif * int main(int argc, char *argv[]) * { * } * @endcode */ #define main SDL_main /** The prototype for the application's main() function */ extern C_LINKAGE int SDL_main(int argc, char *argv[]); /** @name From the SDL library code -- needed for registering the app on Win32 */ /*@{*/ #ifdef __WIN32__ #include "begin_code.h" #ifdef __cplusplus extern "C" { #endif /** This should be called from your WinMain() function, if any */ extern DECLSPEC void SDLCALL SDL_SetModuleHandle(void *hInst); /** This can also be called, but is no longer necessary */ extern DECLSPEC int SDLCALL SDL_RegisterApp(char *name, Uint32 style, void *hInst); /** This can also be called, but is no longer necessary (SDL_Quit calls it) */ extern DECLSPEC void SDLCALL SDL_UnregisterApp(void); #ifdef __cplusplus } #endif #include "close_code.h" #endif /*@}*/ /** @name From the SDL library code -- needed for registering QuickDraw on MacOS */ /*@{*/ #if defined(__MACOS__) #include "begin_code.h" #ifdef __cplusplus extern "C" { #endif /** Forward declaration so we don't need to include QuickDraw.h */ struct QDGlobals; /** This should be called from your main() function, if any */ extern DECLSPEC void SDLCALL SDL_InitQuickDraw(struct QDGlobals *the_qd); #ifdef __cplusplus } #endif #include "close_code.h" #endif /*@}*/ #endif /* Need to redefine main()? */ #endif /* _SDL_main_h */
La SDL 2.0 est disponible sur ce lien en version 64 bits
https://www.libsdl.org/download-2.0.php
Il y a aussi ce lien, ci-dessous, qui permet d'effectuer la transition entre le SDL 1.2. et 2, pourquoi pas s'il n'est pas possible de faire fonctionner la SDL 1.2 et que "convertir" le cour de la SDL 1.2 vers la SDL 2 n'est pas insurmontable pour le débutant que je suis...
https://jeux.developpez.com/tutoriel...ide-migration/
Merci par avance pour vos lumières.
Partager