Here’s how to create a windows .exe without a console window, and without having to deal with the WinMain entry point:
- Just keep the “Console” subsystem selected in the project properties
- Add the following to the file containing your “int main(…)” entry point:
1 2 3 |
#ifdef WIN32 #pragma comment(linker, "/SUBSYSTEM:windows /ENTRY:mainCRTStartup") #endif |
Also helpful: redirecting stdout/stderr using freopen:
1 |
freopen("out.log", "w+", stdout); |