Before you begin

Use the source, static lib ,or a DLL? RakNet includes the source, along with the projects to make the DLL and static lib, and samples. It no longer includes pre-built DLLs or libraries - this is due to incompatibilities across compilers. We recommend using the source directly, however you can also use the DLL or static lib projects to build your own. Projects to build the DLL/Static Lib, and the samples, are provided for Microsoft Visual Studio .Net 2003 and 2005. Users of other compilers will have to make their own projects.

DLL Users

Creating a DLL Create a DLL project. I'll assume you know how to do this. In MSVC 7 you would create an empty project, then under Application Settings you check DLL and empty project. Add the source files under the /Source directory to the project. Add to "Additional Include Directories" your directory with the source files. Import ws2_32.lib, or wsock32.lib if you don't have Winsock 2 installed. In MSVC 7 you can right click on the project, select configuration properties / linker / input / additional dependencies and type "ws2_32.lib" in there. Set your project to use multi-threaded runtime libraries. In MSVC 7 you can right click on the project, select configuration properties / C/C++ / Code Generation / Runtime Library and change it to Multi-threaded (/MT). Add _RAKNET_DLL to the Preprocessor Definitions. In VS Project Properties -> Configuration Properties -> C/C++ -> PreProcessor -> Preprocessor Definitions Set the character set to "not set".In VS Project Properties -> Configuration Properties -> General-> Character Set Optionally set your preprocessor directives. Then hit F7 or the equivalent to build your DLL and Lib.
Creating an empty DLL project in .net 2003
Setting Multithreaded debug in .net 2003
Including ws2_32.lib in .net 2003
Game Setup Copy the DLL you just created to your game in the same directory as the exe. The lib can be in any directory you want. Add the .lib to your project Add all header files from /Source to your project If you want to jump right in, refer to the Basic code tutorial For more detail, refer to Detailed Implementation

Source users

Game Setup Add the files under the /Source directory to the project. While not all of these are strictly necessary, the ones you don't use won't hurt you. Import ws2_32.lib, or wsock32.lib if you don't have Winsock 2 installed. In MSVC 7 you can right click on the project, select configuration properties / linker / input / additional dependencies and type "ws2_32.lib" in there. Set your project to use multi-threaded runtime libraries. In MSVC 7 you can right click on the project, select configuration properties / C/C++ / Code Generation / Runtime Library and change it to Multi-threaded (/MT). Set an additional include path to include the RakNet source (if you copied the source files to a different directory). Optionally set your preprocessor directives.
Setting Multithreaded debug in .net 2003
Including ws2_32.lib in .net 2003

3rd party dependencies

Projects that won't compile by default
Not all projects will build without installing 3rd party dependencies. These are not required to use the majority of RakNet, however you will be missing specific features or demos without them.
3rd party dependencies page

See Also

Index 3rd party dependencies Introduction System Overview Detailed Implementation Tutorial Preprocessor directives