The debug output console window

edited September 2014 in General discussions
Related to my previous question here: https://forum.orx-project.org/discussion/7129#Comment_7129

I am curious as to how to suppress the debug output window from appearing when a game is executed.

I had assumed that building against release would do this or perhaps a config setting.

Is it possible to execute on a desktop environment without the debug console window appearing?

(I am sure this question has been asked before or discussed but I can't find the reference)

Comments

  • edited September 2014
    Ah. This isn't quite a simple answer, I'm afraid: it's platform dependent.

    On Windows, it's controlled at compile time by what is called the "subsystem". This one can be set (among other options) to either console or windows. In console mode, you get the console (heh!), in windows mode, you don't.

    If you use minGW, you get the console mode by default and you need to supply the -mwindows switch to the linker to get the window mode.
    With Visual Studio, it's in the project configuration->Linker->System->Subsystem

    On Linux, you can't control it as far as I know. From what I understand, It depends if the executable is started from a console or a launcher. Please correct me if I'm wrong.

    On OS X, the only way to hide the terminal is by packaging your executable as an "Application". There are many ways to do that, I'm using the plain old manual one: I create the application structure manually.

    An application is a simple folder hierarchy as described here: https://developer.apple.com/library/mac/documentation/corefoundation/conceptual/cfbundles/BundleTypes/BundleTypes.html

    I keep a template (the <MyGame>.app root folder which contains a Contents folder that finally contains both MacOS and Resources sub-folders) on disk and simply copy the binary + data to MacOS when ready.
    The icon file goes into Resources (.icns) and there's an Info.plist directly inside the parent folder that describes the application, version, author, etc.

    Lastly, if you use premake, it's controlled by the function kind(), you can pass it either ConsoleApp or WindowedApp. It'll only have an effect on windows or OS X (though in that case it only deals with the Info.plist as far as I understand).
  • edited September 2014
    Ah of course, I should have had a clue based on my Visual Studio C# development where the console vs windows is configured in the project.

    Thank you again.

    For anyone interested for doing this in codelite, the setting is similar to Visual Studio quoted above:

    1. Edit Project Settings
    2. Common Settings / Linker
    3. Linker Options: -mwindows
    4. Recompile and run.

    Note: Common Settings / General / This Program is a GUI application = true (this is suggested in the codelite hint to have the same effect but does nothing... use -mwindows instead).
Sign In or Register to comment.