[Solved] Disable CMD console
[Solved] Disable CMD console
hi, a question I can not see it anywhere,
how I can disable the CMD console that comes out when irrlicht start?
Greetings.
how I can disable the CMD console that comes out when irrlicht start?
Greetings.
Last edited by etreum79 on Wed Mar 06, 2013 3:28 pm, edited 1 time in total.
Re: Disable CMD console
hi,
from the first example (the second part).
/*
To be able to use the Irrlicht.DLL file, we need to link with the Irrlicht.lib.
We could set this option in the project settings, but to make it easy, we use a
pragma comment lib for VisualStudio. On Windows platforms, we have to get rid
of the console window, which pops up when starting a program with main(). This
is done by the second pragma. We could also use the WinMain method, though
losing platform independence then.
*/
#ifdef _IRR_WINDOWS_
#pragma comment(lib, "Irrlicht_d.lib")
#pragma comment(linker, "/subsystem:windows /ENTRY:mainCRTStartup")
#endif
regards
zerochen
from the first example (the second part).
/*
To be able to use the Irrlicht.DLL file, we need to link with the Irrlicht.lib.
We could set this option in the project settings, but to make it easy, we use a
pragma comment lib for VisualStudio. On Windows platforms, we have to get rid
of the console window, which pops up when starting a program with main(). This
is done by the second pragma. We could also use the WinMain method, though
losing platform independence then.
*/
#ifdef _IRR_WINDOWS_
#pragma comment(lib, "Irrlicht_d.lib")
#pragma comment(linker, "/subsystem:windows /ENTRY:mainCRTStartup")
#endif
regards
zerochen
Re: Disable CMD console
hi, if you use codeblocks ide
theres a dropdown menu in your build dialog where you can change from console app to gui app, then no console window will be opened when app starts.
theres a dropdown menu in your build dialog where you can change from console app to gui app, then no console window will be opened when app starts.
Re: Disable CMD console
This should be included in the FAQs as it is a question i see very often ... Wait! it is already there!
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
Re: Disable CMD console
Hi, neither solutions work for me, I use VS 2012,
to put this in the header:
# ifdef _IRR_WINDOWS_
# pragma comment (lib, "Irrlicht.lib")
# pragma comment (linker, "/ subsystem: windows / ENTRY: mainCRTStartup")
# endif
the compiler says:
MSVCRT.lib (crtexe.obj): error LNK2001: unresolved external symbol _main
to put this in the header:
# ifdef _IRR_WINDOWS_
# pragma comment (lib, "Irrlicht.lib")
# pragma comment (linker, "/ subsystem: windows / ENTRY: mainCRTStartup")
# endif
the compiler says:
MSVCRT.lib (crtexe.obj): error LNK2001: unresolved external symbol _main
Re: Disable CMD console
Mel, if you will kindly tell me where because I swear I do not see it more than I look.
Un saludo granadino!.
Un saludo granadino!.
Re: Disable CMD console
have you had a look a example 1? there they use it and it works.
the error msg says that you have not implemented a main function.
the error msg says that you have not implemented a main function.
Re: Disable CMD console
if you look at the examples, but as you say it gives me error in the main function, the problem is that I have no major function, because what I'm doing is a dll
Re: Disable CMD console
a dll has not a window at all. so you cant hide it.
you have to add the code to your project and not to irrlicht.
you have to add the code to your project and not to irrlicht.
Re: Disable CMD console
http://irrlicht.sourceforge.net/forum/v ... =1&t=25751
There, look for the section
"● How do I compile an Irrlicht app without the console window with MSVC?"
But keeping in mind what you say, it seems VS2012 works other way. You should, in any case, use that pragma for the linker in the main program that calls your DLL, in an EXE not a DLL.
There, look for the section
"● How do I compile an Irrlicht app without the console window with MSVC?"
But keeping in mind what you say, it seems VS2012 works other way. You should, in any case, use that pragma for the linker in the main program that calls your DLL, in an EXE not a DLL.
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
Re: Disable CMD console
#include <windows.h>
use
instead of
use
Code: Select all
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR CmdLine, int nCmdShow)
Code: Select all
int main() {
//Charles
Re: Disable CMD console
thank you very much for all the help, but these methods paraecen not work because I have not a int main () I work with
extern "C"
{
DLL_EXPORT DLL_APIENTRY example ()
{
device-> getTimer () -> setSpeed (Speed);
}
}
extern "C"
{
DLL_EXPORT DLL_APIENTRY example ()
{
device-> getTimer () -> setSpeed (Speed);
}
}
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
Re: Disable CMD console
Well, your answers are slightly off road now. If you compile your whole Irrlicht-related stuff into a DLL, your original statement 'when I start Irrlicht' makes no sense, as you cannot start a dll. So your cmd window would be created by the app that uses the dll. In case you really have an app, your statement that you have no 'main' or similar routine makes no sense, as no app (writenn in C++/C) could come without it. So what's the real point here?
Re: Disable CMD console
He is creating a wrapper, in a DLL, for Irrlicht, so he can call irrlicht from other languages, like freebasic. Hence, there is really no "main" function. But seems that the console appears for some reason in the example application he has created to test his wrapper, and that was what he was trying to get rid of. But at any rate, this problem is solved (he has told me via PM), seems there is another way to kill the console from inside an application, using the function freeConsole().
http://msdn.microsoft.com/es-es/library ... 85%29.aspx
http://msdn.microsoft.com/es-es/library ... 85%29.aspx
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
Re: Disable CMD console
I doubt, though, that this window is created by the dll. Of course you can kill the console from the dll as well, but a better way is probably to compile the freebasic app with proper settings to avoid the console at all.