cgccmingwsdl

Remove console window with SDL application


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?


Solution

  • Compiling with -mwindows fixed it.