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

Author Topic: Console Window display option not working SFML,Cmake,Mingw,Codeblocks  (Read 4081 times)

0 Members and 1 Guest are viewing this topic.

Fierce_Dutch

  • Full Member
  • ***
  • Posts: 138
    • View Profile
Hello all,

I am trying to make a gui application with code blocks, SFML, and Cmake but on windows I have a problem of the console window being displayed. I do not want it to be displayed.

I am using cmake to generate my project. I am generating Codeblocks Mingw32 makefiles. Once I generate those makefiles I open up the generated codeblocks project and try to change the setting from console to GUI in properties but it doesn't work.

I believe the problem is that I am setting a variable in codeblocks even though codeblocks is using Mingw32 as a tool to compile so the setting has no effect. Is there any way to set my program to be a GUI in the Cmake file?

Right now I have a workaround of using windows.h to find the console windows and hide it with this command function in my console class:
void ConsoleWindow::HideConsoleWindow (void){
//----------------------------------------------------------------------------------------------------
   ShowWindow(this->CONSOLE, SW_HIDE);
}

I like how this works, but I don't like how the console pops up on the start of the program then disappears. Is there anyway I can fix this via Cmake or codeblocks?

Thanks,
Brent

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Console Window display option not working SFML,Cmake,Mingw,Codeblocks
« Reply #1 on: February 02, 2013, 06:10:12 pm »
You must add the WIN32 flag to the add_executable command (it is explained in the CMake documentation).
Laurent Gomila - SFML developer

Fierce_Dutch

  • Full Member
  • ***
  • Posts: 138
    • View Profile
Re: Console Window display option not working SFML,Cmake,Mingw,Codeblocks
« Reply #2 on: February 02, 2013, 06:49:57 pm »
You must add the WIN32 flag to the add_executable command (it is explained in the CMake documentation).

Awesome! Thankyou Laurent!

 

anything