User forums > Using Code::Blocks

Turn off dos window

<< < (2/2)

rickg22:
I *KNEW* I was forgetting something! :oops: :lol:

MikeR:

--- Quote from: mandrav 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...

--- End quote ---

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

--- End quote ---

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

thomas:
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).

MikeR:
"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.

thomas:
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.

Navigation

[0] Message Index

[*] Previous page

Go to full version