Saturday, December 27, 2008

(0) Comments

Setting Up Visual Studio .NET 2003 for SDL

welcome to

First off, click here to get the SDL development binaries. Extract the .zip file to your main drive (it should make its own folder).

In Visual Studio, create a new Win32 Project and call it "SDL_Start". In the Win32 Application Wizard window that pops up, select Application Settings and check Empty project.

Select Tools->Options. In the left pane, select the Projects folder (you may have to scroll down), and select VC++ Directories.

In the Show directories for: drop-down menu in the top right, select Include files. Click the New Line button (looks like a folder with a star behind it, see the picture below). Click on the ... button that appears (again, see the picture below).

Navigate to where you extracted SDL to (probably c:\SDL-1.2.8) and highlight the include folder. Click Open.

Now select Library files from the Show directories for: drop-down menu. Again, click the New Line button and then click the ... button. Navigate to the folder you extracted SDL to, only this time highlight the lib folder and click Open.

You've now told Visual Studio where to find SDL. This is a one-time process so you should only need to do it again if you reinstall Visual Studio.

For the next part, you'll need to have a C++ file in your project. Add a file called "Main.cpp" to the project.

Select Project->SDL_Start Properties. Under the C/C++ folder in the left pane, select Code Generation. In the drop-down menu to the right of Runtime Library, select Multi-threaded DLL (/MD). You must do this for every project that uses SDL. If you start a project and get a bunch of errors when you try to compile, make sure you haven't forgotten this step.

Now you need to go back to SDL_Start Properties and select the Linker folder in the left pane. Below Linker, click on Input. To the right of Additional Dependencies, type "sdl.lib sdlmain.lib" without the quotes (see the picture below). This also needs to be done for each project.

The last thing you need to know is that you have to put the SDL.dll file in your project directory for every project that uses SDL. You can find this file in the lib folder where you installed SDL. Just copy and paste it into any project that uses SDL. When you distribute your programs, make sure that this dll is in the same directory as your progam's .exe file.

You're now ready to start using SDL.

0 Responses to "Setting Up Visual Studio .NET 2003 for SDL"

Post a Comment