Page 1 of 2

Not console application. Is possilbe?

Posted: Wed May 07, 2008 11:24 am
by pelonzudo
Hello every one. I'm new in that of irrlicht and I'm doing some tuturials. I'm using CodeBlocks and VC++ compiler. All is going "fine" (for now) but I have a question. Is it possible maque the "game" a non console application?

When I compile the project, one of the settings is "console application" and when I run it display a console that opens a window. So I want to star the application without the "console window" so I don't have the two windows (console and "game")

Is that possible? Or could I hide the console? When I change to proyect form console application to window application I get a Linker error.

Thanks in advance.

PD: Sorry if I don't write so well, I'm spanish.

Posted: Wed May 07, 2008 11:37 am
by dgrafix
Its possible. Under compiler settings targets (in codeblocks anyway) you can choose console or window app.
I find the console very useful when debugging though, but wont be needed for release version.

Posted: Wed May 07, 2008 11:42 am
by Halifax
Yes you can do it the way that dgrafix explained, or you can just do(on Windows):

Code: Select all

#include <windows.h>

...

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
instead of

Code: Select all

int main()
int main(int argc, char **argv)
int main(int argc char *argv[])
etc.

Posted: Wed May 07, 2008 12:04 pm
by Saturn
Halifax wrote:or you can just do(on Windows):
...
It is not or, it is and. ;)

Posted: Wed May 07, 2008 1:42 pm
by MasterGod
This is how I do it in my engine.

Code: Select all

//! Define _NGE_DISABLE_CONSOLE_ON_VC_RELEASE to enable console Only on Debug build with VC.
/*! This shows console only when the engine is compiled on Debug build. Release build
wont have the console shown. Comment this line out to disable this feature which means
the console will always be shown. */
#define _NGE_DISABLE_CONSOLE_ON_VC_RELEASE
#if defined(_NGE_DISABLE_CONSOLE_ON_VC_RELEASE)
#	if(GAME_PLATFORM == PLATFORM_WIN32) && (GAME_COMPILER == COMPILER_MSVC)
#		if BUILD_TYPE == DEBUG_BUILD
#			pragma comment(linker, "/subsystem:console")
#		else
#			pragma comment(linker, "/subsystem:windows /ENTRY:mainCRTStartup")
#		endif
#	endif
#endif

Posted: Wed May 07, 2008 2:20 pm
by MasterGod
Halifax wrote:Yes you can do it the way that dgrafix explained, or you can just do...Windows)
:lol:

Posted: Wed May 07, 2008 2:22 pm
by twilight17
MasterGod wrote:[helpful code]
Thanks MasterGod! Thats a good code snippet :wink:

Posted: Wed May 07, 2008 7:08 pm
by pelonzudo
Thanks for the info. I solved adding to debug compilation

Code: Select all

/subsystem:console
and to de release compilation

Code: Select all

/subsystem:windows
/ENTRY:mainCRTStartup

Now, I got another problem. I have that error in debug mode. I was reading about it, and all says that I just could ignore it. Is there anyway to solve it?

Code: Select all

LIBC.lib(sbheap.obj)||warning LNK4099: PDB 'libc.pdb' was not found with 'C:\Archivos de programa\Microsoft Visual C++ Toolkit 2003\lib\LIBC.lib' or at 'D:\****\bin\Debug\libc.pdb'; linking object as if no debug info|

Posted: Thu May 08, 2008 12:45 am
by MasterGod
About the error. Clean the solution then compile again, it should fix it.

Posted: Mon May 12, 2008 10:07 am
by fabs
owned

Excellent work

Posted: Tue Jul 15, 2008 12:30 pm
by nobleqiao
Really Great Job :)

Posted: Thu Nov 13, 2008 8:22 am
by stash
Hey pelonzudo.. Your solution "
I solved adding to debug compilation
Code:

/subsystem:console

and to de release compilation
Code:

/subsystem:windows
/ENTRY:mainCRTStartup
"
it´s aplicable only for VC?

How can I solve this situation in CodeBlocks? Please, I need help.

Posted: Thu Nov 13, 2008 10:33 am
by rogerborg
Code::Blocks using what compiler?

Posted: Thu Nov 13, 2008 12:27 pm
by hybrid
c::b should have a project setting which works compiler independent. Just read the docs.

Posted: Thu Nov 13, 2008 7:18 pm
by stash
CB with MingW.