Helle everyone who can help me please

int main(int argc, char *argv[])
{ SDL_Window *fenetre= NULL;
if (SDL_Init(SDL_INIT_VIDEO)!= 0)
{
SDL_log(“error: initiation sdl > %s”,SDL_GetError());
exit(EXIT_FAILURE);
}
fenetre= SDL_CreateWindow(“premiere fenetre”,SDL_WINDOWPOS_CENTERED,SDL_WINDOWPOS_CENTERED,800,600,0);
if (fenetre== NULL)
{
SDL_log(“error: creation fenetre echouer > %s”,SDL_GetError());
exit(EXIT_FAILURE);
}
SDL_Quit();
EXIT_SUCCESS;
}

What are we supposed to help with? What’s the problem?

Is this related to exercism in any way?

Salut @djounaid ,

This community can help with matters related to Exercism. If you want to learn SDL, you have to study by yourself.

I imagine that your program doesn’t compile and, if it does and you simply posted a wrong part of it here, the window closes too fast for you to see anything.

Just to help you a bit, try the following program:

#include <SDL2/SDL.h>
#include <SDL2/SDL_error.h>   //pour les fonctions d'erreur et Log
#include <SDL2/SDL_keycode.h> //pour les événements clavier
#include <SDL2/SDL_video.h>   //pour SDL_Window

#include <stdlib.h> //pour atexit()

int main(int argc, char *argv[]) {
  atexit(SDL_Quit);

  SDL_Window *fenetre = NULL;
  if (SDL_Init(SDL_INIT_VIDEO) != 0) {
    SDL_Log("error : initiation sdl > %s", SDL_GetError());
    exit(EXIT_FAILURE);
  }
  fenetre = SDL_CreateWindow("premiere fenetre", SDL_WINDOWPOS_CENTERED,
                             SDL_WINDOWPOS_CENTERED, 800, 600, 0);
  if (fenetre == NULL) {
    SDL_Log("error : creation fenetre echouer > %s", SDL_GetError());
    exit(EXIT_FAILURE);
  }

  int running = 1;
  SDL_Event event;
  printf("Hello");

  while (running) {
    while (SDL_PollEvent(&event)) {
      if (event.type == SDL_QUIT) {
        running = 0;
        break;
      }
      if (event.type == SDL_KEYDOWN) {
        if (event.key.keysym.sym == SDLK_SPACE) {
          running = 0;
          break;
        }
      }
    }
  }

  return EXIT_SUCCESS;
}

You did not post any include headers in your post. This makes it effectively useless, as there are no definitions for the functions you attempt to call. You also used SDL_log, which is a mathematical logarithmic function, instead of SDL_Log which executes the printing you probably expected. Finally, “” quotes were used, which have nothing to do with ".

In order to compile your program, you need to include the SDL library. This is an easy way to do it:

gcc exec.c $(pkg-config --cflags --libs sdl2) ; ./a.out

Study C first before you attempt to study SDL. If you want to study SDL, try the following resources:

Bonne chance!