# Suppressing/disabling console window in SDL?

This topic is 4072 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hey all, I'm wondering if it's possible to disable the console window that SDL automatically creates in Windows. I'm working on a shareware application using the library, and I don't want to confuse users with a second "useless" window. Is it possible to start SDL via a WinMain function, and if so, are there some examples out there? Appreciate it, - carb

##### Share on other sites
SDL overwrites winmain if you link SDLmain.lib in your project and also set your project as a "Windows" rather than "console" project

##### Share on other sites
Quote:
 Original post by Kelly GSDL overwrites winmain if you link SDLmain.lib in your project and also set your project as a "Windows" rather than "console" project

In further explanation, if you use Dev-CPP, create a "Windows Application" or change the current project to "Win32 GUI". The WIN32 GUI is in the Project-Project Options->General Tab.

Note that you will still use the same code! Your main function will still be:
int main(int argc, char* argv[])

Even though you are using a Win32 App. If you use Visual Studio, you must create a "Win32 Application" and use that instead of the "Win32 Console Application". Once again, your code will be the exact same! That's all there is to enabling/disabling that console window really. The SDLmain.lib main replaces the WinMain as Kelly has said.

- Drew

##### Share on other sites
If your using mingw from the command line use the -mwindows option to remove the console window.

##### Share on other sites
There has to be a way to disable this with a Preprocessor definition or something. I too have built an SDL application with VC++ 2005 and have the console that I can't get rid of.

I've even copied over the preprocessor defs from a new Win32 application but I still get a console.

Does anyone know how to disable this within an already existing project?

##### Share on other sites
When you created you SDL project did you remember to set it as a Win32 Project and not a console one?

##### Share on other sites
I would think that the start function for a GUI subsystem exe would need to be changed from WinMain to main. Perhaps there is a configuration dialog that allows for making the change?

##### Share on other sites
Quote:
 Original post by Lazy FooWhen you created you SDL project did you remember to set it as a Win32 Project and not a console one?

No, and I don't create a new project and dump everything in to it. I found out how to change this problem anyhow.

If you are using VC++ 2005, you can change it from a Console to Win32 app by doing this:

Project > Properties > Linker > System > SubSystem (change to /SUBSYSTEM:WINDOWS)

I appreciate the quick feedback.

EDIT: For some reason, at first it seems to make more sense to make a "console" project. Once you realize the console will not go away it becomes a problem.

EDIT 2: After changing my project to a Win32 project and recompiling, I noticed a significant decrease in FPS wile in windowed mode. In fullscreen, the fps is the same as before. Anyone else notice any performance hit?

EDIT 3: Ignore edit #2. Problem was totally unrelated to console/window.

[Edited by - Maxamor on December 28, 2006 4:58:40 PM]