Author Topic: Turn off dos window  (Read 8970 times)

MikeR

  • Guest
Turn off dos window
« on: October 27, 2005, 03:57:28 am »
I don't use windows code. (having too much umm, fun, learning C++ to study that wacky code) I usually start my projects with a console window. The problem is that it gives that dos window in the background. In Dev-Cpp, there is a check mark in the compiler setup to turn it off. I haven't found a way to get rid of it in code::blocks.
If there is a way with codeblocks and vc toolkit 2003 to turn it off, please let me know.
If not, this is a feature request. Those dos windows suck, and make my apps look bad.
Thanks

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: Turn off dos window
« Reply #1 on: October 27, 2005, 04:33:08 am »
Just link with -mwindows option. Well, at least that works for GCC...

obirsoy

  • Guest
Re: Turn off dos window
« Reply #2 on: October 27, 2005, 04:58:22 am »
Setting /SUBSYSTEM:WINDOWS linker option will get rid off the console window. But now the entry point of the application will be WinMain (instead of main), in order to make main the entry point again (without the console window) you should also set /ENTRY:"mainCRTStartup" linker option. Note that I have used these settings with Visual Studio 2003 Professional and Visual Studio 2005 Team Suite RC1, so YMMV.

Good Luck...

spoofer

  • Guest
Re: Turn off dos window
« Reply #3 on: October 27, 2005, 08:51:35 am »
-mwindows is deprecated, -Wl,--subsystem,windows should be used instead.

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Turn off dos window
« Reply #4 on: October 27, 2005, 09:20:32 am »
Just set the target as "GUI" in project options.
Stop using /subsystem commands. The above option does it for you in a compiler-neutral way...
Be patient!
This bug will be fixed soon...

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: Turn off dos window
« Reply #5 on: October 27, 2005, 06:15:03 pm »
I *KNEW* I was forgetting something! :oops: :lol:

MikeR

  • Guest
Re: Turn off dos window
« Reply #6 on: October 29, 2005, 03:26:46 am »
Just set the target as "GUI" in project options.
Stop using /subsystem commands. The above option does it for you in a compiler-neutral way...

I did that. I changed it from "console window" to GUI and now I get the following error.

Quote
LIBC.lib(wincrt0.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function _WinMainCRTStartup

I'm not doing a windows app becouse I want my app to be cross platform. (I don't know windows coding anyway)

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Turn off dos window
« Reply #7 on: October 29, 2005, 01:32:06 pm »
One of the things -mwindows does (and "GUI application" for that matter, too) is to silently do -lkernel32 -luser32 -lgdi32. Another thing is it changes main to WinMain, which is what Windows expects.

I just tried compiling a simple int main(){return 0;) just to be 100% sure it really works, and yes, it does.

Maybe something is amiss in your compiler installation, don't know? You might want to add -lkernel32 -luser32 -lgdi32 to options by hand to see if that makes a difference, and maybe have a look if the linker can acutally find those libraries (although you should get an error if it doesn't).
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

MikeR

  • Guest
Re: Turn off dos window
« Reply #8 on: October 29, 2005, 02:35:13 pm »
"mumbles...one of the reasons I hate ms programming".. If I change "int main" to "Winmain", I get a dozen errors telling me that it isn't setup properly.
If I add "-lkernel32 -luser32 -lgdi32 " to the build options, I get lkernel32 could not be accessed.
Oh well. Thanks anyway.

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Turn off dos window
« Reply #9 on: October 29, 2005, 06:47:16 pm »
Don't change main to WinMain... the compiler does that for you.

If it can't access libkernel32.a, then your compiler is incorrectly installed or you forgot to give the correct linker path. In any case you must provide that library somehow.
Do a file search. If you find it, make sure the containing folder is in the linker's search dir. If you don't find it, do a clean reinstall of your compiler.
« Last Edit: October 29, 2005, 06:49:24 pm by thomas »
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."