I have seen windows applications that operate with both a Window and a console. I find myself wondering about this every now and then and I remember whenever I do research it I never find a solution.
Is there a way to program my WinApi C++ application such that I can output to the console as I would normally do when under the linker option SUBSYSTEM:CONSOLE? In other words I can have a Window open, with my WinMain and WndProc etc. but I would also like to do std::cout, std::cin and std::wcout.. A good use-case for that, would be to use the console for logging stuff and the Window as the main application.
Would It be a good idea to use std::system() instead and launch cmd from that and then output? I don't think so, but of course I don't know.
I work on VS2015.
I have C++ project A that has a few files and MyClass.h. It's built with /clr flag.
I have another C++ console project B and is also built with /clr flag. The B has B.cpp with the following content:
I succesfully can build project B. But, when I add project A as reference (right click->Add Reference) to project B, I suddenly get redefinition error of a class that's definied in a file in project A.