Code::Blocks Forums
User forums => Using Code::Blocks => Topic started by: MikeR 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
-
Just link with -mwindows option. Well, at least that works for GCC...
-
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...
-
-mwindows is deprecated, -Wl,--subsystem,windows should be used instead.
-
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 *KNEW* I was forgetting something! :oops: :lol:
-
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.
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)
-
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).
-
"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.
-
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.