Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: hiding console - command and subsystem  (Read 23660 times)

0 Members and 1 Guest are viewing this topic.

qnox

  • Newbie
  • *
  • Posts: 4
    • View Profile
hiding console - command and subsystem
« 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 :)

qnox

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: hiding console - command and subsystem
« Reply #1 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.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
AW: hiding console - command and subsystem
« Reply #2 on: March 03, 2013, 10:17:56 pm »
As described in the FAQ and like 50 other threads. :D
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

datMoka

  • Newbie
  • *
  • Posts: 48
  • Wooo!
    • View Profile
Re: hiding console - command and subsystem
« Reply #3 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;
}

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: hiding console - command and subsystem
« Reply #4 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:
  • It's Windows specific.
  • It adds unnecessary code.
  • It only hides the console window, but doesn't remove it.
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.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Grundkurs

  • Jr. Member
  • **
  • Posts: 55
    • View Profile
Re: hiding console - command and subsystem
« Reply #5 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

Rosme

  • Full Member
  • ***
  • Posts: 169
  • Proud member of the shoe club
    • View Profile
    • Code-Concept
Re: hiding console - command and subsystem
« Reply #6 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
« Last Edit: July 28, 2017, 03:05:32 pm by Rosme »
GitHub
Code Concept
Twitter
Rosme on IRC/Discord

Grundkurs

  • Jr. Member
  • **
  • Posts: 55
    • View Profile
Re: hiding console - command and subsystem
« Reply #7 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
« Last Edit: July 27, 2017, 08:57:24 pm by Grundkurs »

Rosme

  • Full Member
  • ***
  • Posts: 169
  • Proud member of the shoe club
    • View Profile
    • Code-Concept
Re: hiding console - command and subsystem
« Reply #8 on: July 28, 2017, 03:06:11 pm »
My bad, I misread the CMake in your post.
GitHub
Code Concept
Twitter
Rosme on IRC/Discord