- On the SDL download page, get the latest version of the Windows-VC development libraries.
- If you want to use the SDL_mixer library (for sound and music), download the Windows-VC development libraries for SDL_mixer.
- Uncompress the SDL and SDL_mixer libraries to your local drive.
- Consolidate the SDL includes and libraries with the SDL_mixer includes and libraries, so that they're all in a single set of \include and \lib folders. It's easier this way!
- Launch Visual Studio .NET, but do not open a project or solution.
- From the Tools menu, select Options...
- In the tree view, click on Projects and then select VC++ Directories.
- In the Show directories for box, select Include files.
- Click the new-folder icon, and browse to the \include directory where you consolidated your SDL and SDL_mixer header files.
- In the Show directories for box, you now need to select Library files.
- Click the new-folder icon, and browse to the \lib directory where you consolidated your SDL and SDL_mixer library files.
- Click OK.
Your build environment is now set up, and VC++.NET will now know where to find the SDL and SDL_mixer headers and libraries. To create an SDL project, perform the following steps.
- Launch Visual Studio .NET and from the File menu, select New and then Project...
- In the tree view, expand Visual C++ Projects and select Win32.
- If you don't want a console window to appear when your program is executed, select Win32 Project. Otherwise, select Win32 Console Project. Give your project a name and location, then click OK.
- From the Project menu, select Properties... at the bottom of the menu.
- In the tree view, expand C/C++ and select Code Generation.
- Set the Runtime Library value to Multi-threaded DLL or Multi-threaded Debug DLL.
- We're still in the Properties dialog. In the tree view, now expand Linker and select Command Line.
- In the Additional Options field, enter SDL.lib SDLmain.lib and if you are using SDL_mixer, also add SDL_mixer.lib.
- VC++ is now set up. You may add your SDL source code to the project, and proceed as normal.
- The SDL Windows FAQ states that this step is necessary because, "SDL is dynamically linked with the multi-threaded version of the Microsoft Visual C runtime."
- If you plan on running the VC++ debugger with SDL you will have to pass the value SDL_INIT_NOPARACHUTE to SDL_Init in order for debugging to succeed!
- When you compile your executable, you will need to copy the SDL.dll and SDL_mixer.dll files into the same folder as the EXE. If these DLLs are missing, when the program is executed you will be given an error message regarding the needed DLLs.