Remove console window with SDL application
Asked Answered
G

2

5

I have this code:

#include <stdio.h>
#include "SDL/SDL.h"

SDL_Surface *screen = NULL;

int main(int argc, char* args[]) {

    SDL_Init(SDL_INIT_EVERYTHING);

    screen = SDL_SetVideoMode(640, 480, 32, SDL_SWSURFACE);

    SDL_Delay(2000);

    SDL_Quit();
    return 0;
}

And I compile using this command line (Mingw is my compiler):

gcc source.c -o bin.exe -lmingw32 -lSDLmain -lSDL

But when I run the application, although a nice graphical box shows up, an ugly console window also shows up. How can I remove this, to leave just a true graphical application?

Also, how can I revert the mouse back to default? It seems to be using this ugly custom mouse when I hover over the window. I read here that I have to do this myself:

http://www.gamedev.net/topic/297710-change-mouse-cursor-sdl/

Is this really true? Is there no inbuilt functionality to disable using the custom black cursor?

Guideboard answered 2/7, 2013 at 20:16 Comment(1)
I want the user's default mouse. I don't want to have to specify my own custom mouse, or use the black SDL cursor.Guideboard
G
12

Compiling with -mwindows fixed it.

Guideboard answered 2/7, 2013 at 20:39 Comment(0)
A
0

If you are working with Windows Visual Studio, you should just select the Windows (/SUBSYSTEM:WINDOWS) under project configuration -> linker -> System -> Subsystem

enter image description here

Aegis answered 14/8, 2024 at 13:15 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.