Setting Visual Studio Up for Making Binary Modules
Before you continue you should already have a basic understanding of C++. I recommend reading up tutorials found here.
First of all you want to download Visual Studio 2010. It's all personal preference what IDE you use. You can use 2012 or a 2013; you don't even have to use Visual Studio. Visual Studio 2010 is what I'm using for this tutorial, so I recommend using it if it's your first module.
The headers you need and an example are available here. You'll need to click "Download Zip" found to the right of the page. From there extract the include folder somewhere, I recommend somewhere like "C:\Garry's Mod Lua Headers" or "C:\Users<username>\Documents\Garry's Mod Lua Headers"
Open your IDE, in this case Visual Studio 2010, then select new project.
Select "Win32" then click "OK". From here select Win32 Project make the name whatever you want. I recommend something like gm_test for your first module.
There should be a Win32 Application Wizard opened, click next then under "Application type" select DLL. Then check the box "Empty project", finally click "Finish".
Congratulations! You now have an empty project.
Now that you have your empty project you need to set up some directories, add some files and set some properties. Firstly you need to right click the folder "Source Files" and then click "Add new item...".
From inside here click "C++ file (.cpp)", name it "main".
The the next thing you must do is set it to release mode. At the top, near the green play looking button, you should see "Debug" then "Win32". Open the drop down menu on "Debug" and set it to "Release".
Now right click your project, in this case "gm_test", and then click "Properties".
Go into "Configuration Properties" and under "Project Defaults" then go to "Character Set" and select "Use Multi-Byte Character Set". This is helpful with strings so you don't have to use useless shit. Next in "Configuration Properties" make the "Target Name" something like "gmcl_test_win32" so that you can just drag and drop it into your lua/bin folder without having to rename it after every compile.
Now that that's out of the way, click the "C/C++" category and then select "Additional Include Directories", in the drop down menu, select "<Edit...>".
From inside this menu select the little folder icon this should make a new blank entry. Double click it then select the "..." button.
Now go to where you saved your headers to, in this case "C:\Garry's Mod Headers" from here go to "include\GarrysMod\Lua" then click "Select folder". Your full path should be something along the lines of "C:\Garry's Mod Headers\include\GarrysMod\Lua".
Click OK, then Click Apply, then Click OK again. You're almost ready to compile your first module.
Open up main.cpp and add the following code:
If done correctly, you should be able to compile it. Right click your project and click "Rebuild", note that it's a good habit to always select rebuild instead of build.