My Win32 C ++ Hello World program will not compile


So my go to language is C#, so I decided to learn C++. I made a hello world program with this code

#include <stdio.h>    // include the standard input/output header file

void main(void)    // our program starts here
printf("Hello World!");    // print "Hello World!" into the console
return;    // return void to windows

But I then get this error when I compile (I am using Visual Studio 2015)

Error   LNK1120 1 unresolved externals  Render Engine   c:\users\kamaldeep rai\documents\visual studio 2015\Projects\Render Engine\Debug\Render Engine.exe  

Error   LNK2019 unresolved external symbol [email protected] referenced in function "int __cdecl invoke_main(void)" ([email protected]@YAHXZ) Render Engine   c:\Users\kamaldeep rai\documents\visual studio 2015\Projects\Render Engine\Render Engine\MSVCRTD.lib(exe_winmain.obj)

In addition to Paul's answer, here is how you can change the configuration so that linker would look for main:

  1. Open Project Properties
  2. Goto Linker
  3. System -> Subsystem
  4. Change it to Console

Also, your main prototype is not compliant with C++, it should return int