Thanks, that's exactly what I was looking for!
I've added a build target switch, so console window will only appear on debug build:
#ifndef DEBUG
#pragma comment(linker, "/SUBSYSTEM:windows /ENTRY:mainCRTStartup")
#endif
I've put that on top of main.cpp.