M
MuZZy
HI
I just wonder if someone can help me with this:
I have a windows app project developed on VC++ 6.0.
I need to adapt it to be able to compile as a console app as well
(So it would call main() instead of WinMain())
I created a new profile for the project and replaced precompile define _WINDOWS by _CONSOLE,
and changed linker option /subsystem:windows to /subsystem:console.
I also added a condidtional main():
#ifdef _CONSOLE
int main() {...}
#else
int PASCAL WinMain
(
HINSTANCE hinst,
HINSTANCE hinstPrev,
LPSTR pszCmdLine,
int nCmdShow
)
#endif
It compiles fine with both "Debug" and my new "Console Debug" profiles. In first case it starts then
as a Windows app, in second it shows a console. So no problem here.
But, problems come when i try to add some functionality to main(). First if i add those includes,
it doesn't compile, saying that "__cplusplus" is not defined.
#ifdef _CONSOLE
#include <iostream>
#include <ostream> //to use cout
#endif
If i also define __cplusplus, it starts giving hell of other errors in standard c++ headers
like errno.h, stdio.h, etc...
But, if i create a brand new console project and copy all my files there, it compiles and works fine...
So i assume that i still didn't change something in the "Console Debug" profile to work correctly...
Any ideas?
Thank you in advance,
Andrey
If i compile with this new profile
I just wonder if someone can help me with this:
I have a windows app project developed on VC++ 6.0.
I need to adapt it to be able to compile as a console app as well
(So it would call main() instead of WinMain())
I created a new profile for the project and replaced precompile define _WINDOWS by _CONSOLE,
and changed linker option /subsystem:windows to /subsystem:console.
I also added a condidtional main():
#ifdef _CONSOLE
int main() {...}
#else
int PASCAL WinMain
(
HINSTANCE hinst,
HINSTANCE hinstPrev,
LPSTR pszCmdLine,
int nCmdShow
)
#endif
It compiles fine with both "Debug" and my new "Console Debug" profiles. In first case it starts then
as a Windows app, in second it shows a console. So no problem here.
But, problems come when i try to add some functionality to main(). First if i add those includes,
it doesn't compile, saying that "__cplusplus" is not defined.
#ifdef _CONSOLE
#include <iostream>
#include <ostream> //to use cout
#endif
If i also define __cplusplus, it starts giving hell of other errors in standard c++ headers
like errno.h, stdio.h, etc...
But, if i create a brand new console project and copy all my files there, it compiles and works fine...
So i assume that i still didn't change something in the "Console Debug" profile to work correctly...
Any ideas?
Thank you in advance,
Andrey
If i compile with this new profile