Microsoft Visual C
From GMod Wiki
Go to: Development Tools |
This page needs to be edited as it contains information that is unclear or incorrect. Improvement can be discussed on the talk page. Find more pages that need work here. Details: None given. |
Note that the ++ was missing off the page name due to a limitation of MediaWiki
Contents |
What is it?
Microsoft Visual C++ Express Edition is a free version of Microsoft's Visual C++.
It allows developers to write C++ applications with relative ease using both the IntelliSense © as well as integration into the Microsoft Developer Network.
With the correct configuration it is able to develop binary third party modules for Garry's Mod with relative ease.
In this article I will outline on how to set up your computer and your compiler so that you are able to compile binary modules for Garry's Mod.
Where to get?
Microsoft Visual C++ Express Edition 2008 can be obtained here.
Note that it does require registration and the entering of a "registration key" for it to remain active, failure to provide a free key results in a 30 day "trial" period after which you will need to register it for free.
Getting started
Here I will show you how I got started in compiling the gm_sqlite module, its the best example on how to code modules for Garry's Mod.
Requirements
For this tutorial you will need the following
- Microsoft Visual C++ (Any version will do, you can get 2008 Express for free)
- An SVN Client (so you can do a "check-out" of the gm_sqlite source)
- The GMod interface headers, which you can get from the gm_sqlite svn or I have provided some tweaked headers which include a NO_SDK define among other things http://gmodmodules.googlecode.com/svn/trunk/secretheaders/
- The Source SDK (optional if you don't want to interface with the game, and you define NO_SDK)
Setting up your Source SDK "source"
In order to compile some binary modules, you are required to have the Source SDK headers.
These headers can be obtained by creating a new "mod" on your hard drive using the Source SDK, below are some instructions on how to do so.
Method
- Start the Source SDK
- Ensure that you have the following settings selected on the "Source SDK" (these are what I am using, you may be able to get it to work with other Engine/Game combos)
Engine Version: The Orange Box
Current Game: Half-Life 2: Episode Two - Under utilities, Double click on "Create a Mod", this should bring up a "Create a Mod" dialog
- Select "Source code only (advanced users only)" then click next
- Choose a directory, in this tutorial I will use "C:\HL2SDK" as my directory as its easier to find, Click Next
- Wait for the dialog to finish copying files, When finished, Click Next
- Uncheck "Open readme file" (unless you REALLY want to read the read me file...)
- Click "Finish", that should return you to the "Source SDK" window.
Congratulations, you now have the source code required to compile a Garry's Mod binary module, please see the next section on getting the lua interface header files.
Setting up your Lua Interface files
Setting up the Lua Interface files so that MSVC++ is able to find the files should a project not include them will make your life allot easier when you go to compile such a project.
This is probably the easiest part of this process :)
Method
- In keeping with the previous part, create a folder on your hard drive (same one that you dumped the source code on) and call it "GMOD-Interface"
- Using a SVN Program (e.g. Tortoise SVN) do a check-out on the folder you just created to the following SVN URL (or http://gmodmodules.googlecode.com/svn/trunk/secretheaders/)
- Step 3) Wait for the SVN to complete, once completed, click "OK"
- You now have the headers required to compile a binary modules, now lets move on to setting up MSVC++
Setting up Microsoft Visual C++ 2008 Express Edition
(Note this page is a work in progress and may take some time as I have to take screen shots)
To get started quickly, do the following
Bring up your VC++ Directory settings, this can be found under Tools -> Options.. -> "Projects and Solutions" -> "VC++ Directories"
Required Include Directories (listed as "Include files")
- GMOD-Interface
- HL2SDK\common
- HL2SDK\game\client
- HL2SDK\game\server
- HL2SDK\game\shared
- HL2SDK\public\game\server
- HL2SDK\public\tier1
- HL2SDK\public\tier0
- HL2SDK\public
Required Library Directories (listed as "Library files")
- HL2SDK\lib\public