Jump to content
  • Advertisement
Sign in to follow this  
ukdeveloper

Hiding console in SDL app

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've taken a long(ish) break from game development, but I'm back at it again. I managed to forget something important, though; in the past I was able to create a Win32 Console app in VS2005 Pro, but was able to create my SDL window with the console in the background hidden. I'm sure there was an option somewhere to turn it off. How do I do that again? Or do I need to create a new normal Win32 non-console app and load my source files into that? Thanks in advance, ukd.

Share this post


Link to post
Share on other sites
Advertisement
Do not create a Win32 console app. There is an option to turn it off, because I made this mistake myself--however, I don't remember how to make the change. If the project is not big, just recreate it as a Win32 Project that's "empty".

Edit: You can try changing a Linker setting in the Project Properties. On the Linker -> System page, there is a field called "SubSystem", set it to "Windows (/SUBSYSTEM:WINDOWS)".

Share this post


Link to post
Share on other sites
As indicated by Maxamor you can modify your link settings. Your current link settings probably look something like this:

kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib opengl32.lib glut32.lib glu32.lib /nologo /subsystem:console incremental:yes /pdb:"Debug/example.pdb /debug /machine:I386 /out:"Debug/example.exe" /pdbtype:sept

Note the /subsystem:console element. You'll want to change this to the following:

/subsystem:windows /entry:mainCRTStartup

This sets the /subsystem to windows as opposed to console. When this is defined Visual C++ expects to find WinMain() instead of the usual main(). Therefore, if you're using main() then it's necessary to specify the /entry as mainCRTStartup.

Now you have a windows application using the usual main() and no console window.

Share this post


Link to post
Share on other sites
SDL has its own WinMain function, so you don't need to redirect the entry point.

Share this post


Link to post
Share on other sites
Hmm I had forgotten to do that, thanks!

Though all I had to do was add "-mwindows" in my link line in my Makefile.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!