SFML community forums

Help => General => Topic started by: qnox on March 03, 2013, 05:07:10 pm

Title: hiding console - command and subsystem
Post by: qnox on March 03, 2013, 05:07:10 pm
Hello guys,

i want to hide the console who are always open in my SFML project.
Over the boardsearch i found 2 ways:

1. Hiding by a command ... but the commands i found seems only working with sfml 1.6

2. Changing the Subsytem in VisualStudio from Console to Window , but when i change i cant debug/compile my project:

1>------ Build started: Project: SFMLTestProjekt, Configuration: Debug Win32 ------
1>Build started 03.03.2013 16:59:51.
1>InitializeBuildStatus:
1>  Creating "Debug\SFMLTestProjekt.unsuccessfulbuild" because "AlwaysCreate" was specified.
1>ClCompile:
1>  All outputs are up-to-date.
1>ManifestResourceCompile:
1>  All outputs are up-to-date.
1>Link:
1>  All outputs are up-to-date.
1>LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
1>MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup
1>C:\Users\Brause\documents\visual studio 2010\Projects\SFMLTestProjekt\Debug\SFMLTestProjekt.exe : fatal error LNK1120: 1 unresolved externals
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:00.68
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


Did anyone have an idea about it?

Iam using Win8 with VS 2010 + SFML2.0

best regards :)
Title: Re: hiding console - command and subsystem
Post by: qnox on March 03, 2013, 05:38:20 pm
okey i have fix it myself. after change the subsystem. just add sfml-main.lib to the Linker -> Input -> Additional Dependencies.
Title: AW: hiding console - command and subsystem
Post by: eXpl0it3r on March 03, 2013, 10:17:56 pm
As described in the FAQ and like 50 other threads. :D
Title: Re: hiding console - command and subsystem
Post by: datMoka on March 06, 2013, 03:37:58 pm
For anyone else who searches for how to do this, you don't need to look for a solution through SFML. Looking for a solution through the language you're using will probably be easier.

For example this little piece of code hides the console window in C++:
Code: [Select]
#define _WIN32_WINNT 0x0500
#include <windows.h>
#include <iostream>

int main()
{
    HWND hWnd = GetConsoleWindow();
    ShowWindow( hWnd, SW_HIDE );

    return 0;
}
Title: Re: hiding console - command and subsystem
Post by: eXpl0it3r on March 06, 2013, 04:00:38 pm
For example this little piece of code hides the console window in C++:
I don't recommend doing it this way at all!

Because:
The proper way is as said in the official tutorial and every other place, to set the subsystem settings of your project to Window and link against sfml-main.
Title: Re: hiding console - command and subsystem
Post by: Grundkurs on July 26, 2017, 01:18:11 pm
i wrote a little blog-post about how you can get rid of the console-window using SFML and CMake.
https://zaunfish.blogspot.de/2017/07/getting-rid-of-console-window-using.html
Title: Re: hiding console - command and subsystem
Post by: Rosme on July 27, 2017, 02:53:12 pm
1- This is an old thread that didn't need to be updated.
2- You should use FindSfml, and use ${SFML_LIBRARIES} instead of listing the libraries yourself.

EDIT: I misread the Cmake example
Title: Re: hiding console - command and subsystem
Post by: Grundkurs on July 27, 2017, 08:14:58 pm
Thread may be old, but still appears on top of google search when searching for SFML and "No Console-Window. Provided answers to question stay rather vague ("As described in the FAQ and like 50 other threads."), i provided a little more information and don't see the harm in doing so.
Iam using ${SFML_LIBRARIES} and FindSFML.cmake, so i don't get what you mean with Nr.2 of your post. Greetings
Title: Re: hiding console - command and subsystem
Post by: Rosme on July 28, 2017, 03:06:11 pm
My bad, I misread the CMake in your post.