Wednesday, November 6, 2024
spot_img

sdl2 – SDL hello-world program on ArkOS runs with out error, however reveals no output


I lately purchased a R36S retro handheld linux based mostly recreation console. The system runs ArkOS which is a Ubuntu based mostly OS. On boot, the system runs this system EmulatorStation, however it’s doable to stop this program, after which connect with the system by ssh and get a command immediate. Via apt, it’s then doable to put in an entire improvement setting working on the system.

I did so and compiled a easy hello-world SDL2 program, which ought to present a window with graphical output for 5 seconds and exit.

The issue is that nothing is displayed on the system, and there’s no error.

I additionally double checked myself with this system 351Files which is supplied in binary format on arkos. I verified that once I execute the system present model from the command line, it shows its graphical interface. Nonetheless, I additionally pulled the newest model by git, and compiled myself it on the system. And when working the model that I compiled, there was no graphical output, and no error.

Under is the hello-world program which I compiled:

#embrace 
#embrace 

int primary(int argc, char* argv[]) {
    // Initialize SDL
    if (SDL_Init(SDL_INIT_VIDEO) != 0) {
        printf("SDL_Init Error: %sn", SDL_GetError());
        return 1;
    }

    // Create a window
    SDL_Window *win = SDL_CreateWindow("Hiya, SDL2!", 100, 100, 640, 480, SDL_WINDOW_SHOWN);
    if (win == NULL) {
        printf("SDL_CreateWindow Error: %sn", SDL_GetError());
        SDL_Quit();
        return 1;
    }

    // Create a renderer
    SDL_Renderer *ren = SDL_CreateRenderer(win, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
    if (ren == NULL) {
        SDL_DestroyWindow(win);
        printf("SDL_CreateRenderer Error: %sn", SDL_GetError());
        SDL_Quit();
        return 1;
    }

    // Set the draw coloration to blue
    SDL_SetRenderDrawColor(ren, 0, 0, 255, 255);

    // Clear the window
    SDL_RenderClear(ren);

    // Current the window
    SDL_RenderPresent(ren);

    // Wait for five seconds
    SDL_Delay(5000);

    // Clear up
    SDL_DestroyRenderer(ren);
    SDL_DestroyWindow(win);
    SDL_Quit();

    return 0;
}

So my query is what am I lacking to make the graphical output present up?

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisement -spot_img

Latest Articles