When Visual Studio created your project, it configured the project to link in various commonly-used libraries, such as user32.lib and kernel32.lib. Two other libraries need to be added to the project: ws2_32.lib and crypt32.lib.
To do this, right-click your project (not the solution) in the Solution Explorer, and select Properties. When the following Property Pages window appears, be sure the Configuration control and the Platform control (both at the top of the window) are set to All Configurations and All Platforms, as shown in the picture below.
After doing that, navigate to Configuration Properties > Linker > Input > Additional Dependencies.
If the list of Additional Dependencies does not contain ws2_32.lib and crypt32.lib, add them. Note that semicolons are used to separate each file in the list. Note also that it does not matter what order the files are listed in: you can add the two new files to the front of the list if you want.
Do not dismiss the Property Pages window; you will need it for the next steps.