I try to setup a SDL2 project on Eclipse (on mac) for a class project.
I followed this video tutorial “https://www.youtube.com/watch?v=EQyAjNMjMkM”.
I tried the following code and I have no errors but the window doesn’t open, there is just the icon of a “ghost” program that opens (as in the picture below). I searched for a solution on the internet but impossible to find something about it …
Someone would have already encountered this problem ?
[Testing code]
#include <stdio.h>
#include <SDL2/SDL.h>
int main(int argc, char** argv)
{
if (SDL_Init(SDL_INIT_VIDEO) != 0 )
{
fprintf(stdout,"Failed to initialize the SDL (%s)\n",SDL_GetError());
return -1;
}
{
SDL_Window* pWindow = NULL;
pWindow = SDL_CreateWindow("My first SDL2 application",SDL_WINDOWPOS_UNDEFINED,
SDL_WINDOWPOS_UNDEFINED,
640,
480,
SDL_WINDOW_SHOWN);
if( pWindow )
{
SDL_Delay(3000);
SDL_DestroyWindow(pWindow);
}
else
{
fprintf(stderr,"Error creating the window: %s\n",SDL_GetError());
}
}
SDL_Quit();
return 0;
}
[The “ghost” program]