Author Topic: GUI application opens console window on execution  (Read 5351 times)

darus

  • Guest
GUI application opens console window on execution
« on: May 20, 2006, 04:34:47 pm »
Hi.

I've started using CodeBlocks two days ago.

I'm trying to create a wxWidgets application. I've created test app with static unicode wxWidgets template, so my *.cbp file looks like:
Code
<?xml version="1.0"?>
<!DOCTYPE Code::Blocks_project_file>
<Code::Blocks_project_file>
<FileVersion major="1" minor="1"/>
<Project>
<Option title="wxWidgets application"/>
<Option makefile="Makefile"/>
<Build>
<Target title="default">
<Option type="0"/>
</Target>
<Environment>
<Variable name="WX_DIR" value="C:\wxWidgets-2.6.2"/>
<Variable name="WX_CFG" value=""/>
</Environment>
</Build>
<Compiler>
<Add option="-pipe"/>
<Add option="-mthreads"/>
<Add option="-Winvalid-pch"/>
<Add option="-include &quot;wx_pch.h&quot;"/>
<Add option="-D__GNUWIN32__"/>
<Add option="-D__WXMSW__"/>
<Add option="-DwxUSE_UNICODE"/>
<Add option="-DUSE_PCH"/>
<Add directory="$(WX_DIR)\include"/>
<Add directory="$(WX_DIR)\lib\gcc_lib$(WX_CFG)\mswu"/>
<Add directory="$(WX_DIR)\contrib\include"/>
</Compiler>
<ResourceCompiler>
<Add directory="$(WX_DIR)\include"/>
</ResourceCompiler>
<Linker>
<Add library="wxmsw26ud_core"/>
<Add library="wxbase26ud"/>
  <Add library="winspool"/>
<Add library="winmm"/>
<Add library="shell32"/>
<Add library="comctl32"/>
<Add library="ctl3d32"/>
<Add library="odbc32"/>
<Add library="advapi32"/>
<Add library="wsock32"/>
<Add library="opengl32"/>
<Add library="glu32"/>
<Add library="ole32"/>
<Add library="oleaut32"/>
<Add library="uuid"/>
<Add library="gdi32"/>
<Add library="comdlg32"/>
  <Add directory="$(WX_DIR)\lib\gcc_lib$(WX_CFG)"/>
</Linker>
<Unit filename="wx_pch.h">
<Option link="0"/>
<Option weight="0"/>
<Option target="default"/>
</Unit>
</Project>
</Code::Blocks_project_file>

When running resulting *.exe from Explorer two windows are shown: console and gui. What is the annoying console window for? Is there any way to get rid of it?

Sorry for my bad english, I' m from Russia.

Thanks!

Offline Ceniza

  • Developer
  • Lives here!
  • *****
  • Posts: 1441
    • CenizaSOFT
Re: GUI application opens console window on execution
« Reply #1 on: May 20, 2006, 04:55:47 pm »
Be sure in Project -> Properties, Target tab, the Type is "GUI application" and no "Console application".

Now all you need is your application is re-linked (rebuild should do, or just add a new line at the end of any file).

If that doesn't work (it should), add -mwindows to the linker options (for MinGW).

darus

  • Guest
Re: GUI application opens console window on execution
« Reply #2 on: May 20, 2006, 05:01:17 pm »
Target type is "GUI application", yes.

Adding "-mwindows" to linkers options helped. Console window is gone  :D

Thanks a lot!