My psychic debugging powers tell me that your build tools are configured to create your application in GUI rather than console mode.
If you reconfigure the build so that it generates a console mode application, you won't need to call AllocConsole
or do anything special; you'll automatically be assigned to the console of the parent process.