Good morning,
I have read a french book dealing with C and SDL 1.2 (openclassroom, site du zero). I would like to use microsoft Visual C 2010 with SDL 2.0 I have understood new functions are used with SDL 2.0.
Here is a short program and the compilation errors
/* programme du site du zero p 313 mn 2017/04/21 */
#include <stdlib.h>
#include <stdio.h>
#include <SDL/SDL.h>
void pause();
int main(int argc, char *argv[])
{
SDL_Init(SDL_INIT_VIDEO);
/* SDL_SetVideoMode(640,480,32,SDL_HWSURFACE); */
SDL_Window *screen = SDL_CreateWindow("My Game Window",
SDL_WINDOWPOS_UNDEFINED,
SDL_WINDOWPOS_UNDEFINED,
640, 480,
SDL_WINDOW_FULLSCREEN | SDL_WINDOW_OPENGL);
pause();
SDL_Quit();
return EXIT_SUCCESS;
}
void pause()
{
int continuer=1;
SDL_Event event;
while (continuer)
{
SDL_WaitEvent(&event);
switch(event.type)
{
case SDL_QUIT :
continuer=0;
}
}
}
with the following errors
1>------ Début de la génération : Projet : testsdl, Configuration : Debug Win32 ------
1> main.c
1>c:\users\clevo\documents\sdl_mixer_2017\projets\essai_01_x86\testsdl\testsdl\main.c(16): error C2275: 'SDL_Window' : utilisation non conforme de ce type comme expression
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\sdl\sdl_video.h(90) : voir la déclaration de 'SDL_Window'
1>c:\users\clevo\documents\sdl_mixer_2017\projets\essai_01_x86\testsdl\testsdl\main.c(16): error C2065: 'screen' : identificateur non déclaré
========== Génération : 0 a réussi, 1 a échoué, 0 mis à jour, 0 a été ignoré ==========
An other attempt with even less instructions
/* programme du site du zero p 313 mn 2017/04/21 */
#include <stdlib.h>
#include <stdio.h>
#include <SDL/SDL.h>
void pause();
int main(int argc, char *argv[])
{
SDL_Init(SDL_INIT_VIDEO);
/* SDL_SetVideoMode(640,480,32,SDL_HWSURFACE); */
/*
SDL_Window *screen = SDL_CreateWindow("My Game Window",
SDL_WINDOWPOS_UNDEFINED,
SDL_WINDOWPOS_UNDEFINED,
640, 480,
SDL_WINDOW_FULLSCREEN | SDL_WINDOW_OPENGL);
*/
pause();
SDL_Quit();
return EXIT_SUCCESS;
}
void pause()
{
int continuer=1;
SDL_Event event;
while (continuer)
{
SDL_WaitEvent(&event);
switch(event.type)
{
case SDL_QUIT :
continuer=0;
}
}
}
with the errors
1>------ Début de la génération : Projet : testsdl, Configuration : Debug Win32 ------
1> main.c
1>LINK : fatal error LNK1123: échec lors de la conversion en fichier COFF : fichier non valide ou endommagé
========== Génération : 0 a réussi, 1 a échoué, 0 mis à jour, 0 a été ignoré ==========
Coul’d you help me to obtain a very short program without error, using Visual C++ Express 2010 (with C langage) on Windows 7 ?