9 <TITLE> Using SDL with Microsoft Visual C++ 5 and 6 </TITLE>
21 <H1> Using SDL with Microsoft Visual C++ 5 and 6 </H1>
24 by <A HREF="mailto:snowlion@sprynet.com"> Lion Kimbro </A>
30 You can either use the precompiled libraries from
31 <A HREF="http://www.libsdl.org/download.html">
32 the SDL Download web site </A>,
33 or you can build SDL yourself.
37 <H3> Building SDL </H3>
40 Unzip the <CODE>VisualC.zip</CODE> file into the directory
41 that contains this file (<CODE>VisualC.html</CODE>).
45 Be certain that you unzip <CODE> VisualC.zip </CODE>
46 into <strong>this</strong> directory and not any other
47 directory. If you are using WinZip, be careful to
48 make sure that it extracts to <strong>this</strong>
49 folder, because it's convenient feature of
50 unzipping to a folder with the name of the
51 file currently being unzipped will get you in
52 trouble if you use it right now. And that's all
53 I have to say about that.
57 Now that it's unzipped, go into the VisualC directory
58 that is created, and double-click on the VC++
59 workspace file "<CODE>SDL.dsw</CODE>".
60 This should open up VisualC.
64 You may be prompted at this point to upgrade the
65 workspace, should you be using a more recent version
66 of Visual C++. If so, allow the workspace to be
72 Build the <CODE>.dll</CODE> and <CODE>.lib</CODE> files.
76 This is done by right clicking on each project in turn
77 (Projects are listed in the Workspace panel in the
78 FileView tab), and selecting "Build".
82 You may get a few warnings, but you should not get
83 any errors. You do have to have at least the DirectX
84 5 SDK installed, however. (I believe...) The latest
85 version of DirectX can be downloaded or purchased
86 on a cheap CD (my recommendation) from
87 <A HREF="http://www.microsoft.com"> Microsoft </A>.
91 Later, we will refer to the following .lib and .dll
92 files that have just been generated:
102 Search for these using the Windows Find (Windows-F)
103 utility, if you don't already know where they should be.
104 For those of you with a clue, look inside the Debug
105 or Release directories of the subdirectories of the
106 VisualC folder. (It might be easier to just use
107 Windows Find if this sounds confusing. And don't worry
108 about needing a clue; we all need visits from the
109 clue fairy frequently.)
114 <H3> Creating a Project with SDL </H3>
117 Create a project as a Win32 Application.
121 Create a C++ file for your project.
125 Set the C runtime to "Multi-threaded DLL" in the menu:
126 <CODE> Project|Settings|C/C++ tab|Code Generation|Runtime Library </CODE>.
130 Add the SDL <CODE>include</CODE> directory to your list
131 of includes in the menu:
132 <CODE> Project|Settings|C/C++ tab|Preprocessor|Additional include directories </CODE>.
136 The "include directory" I am referring to is the
137 <CODE>include</CODE> folder within the main SDL
138 directory (the one that this HTML file located
143 Now we're going to use the files that we had created
144 earlier in the Build SDL step.
148 Copy the following files into your Project directory:
156 Copy the following files into your Project directory,
157 and <em>add them to your Project</em> as well:
162 <li> SDLmain.lib </li>
166 (To add them to your project, right click on your
167 project, and select "Add files to project")
171 (I believe that it's not necessary to actually
172 copy the .lib files into your directory; you only
173 have to be certain that you add them to your Project.
174 If someone is so inclined, correct this document, or
175 <A HREF="mailto:snowlion@sprynet.com">
177 and I'll fix this document.)
182 <H3> SDL 101, First Day of Class </H3>
185 Now create the basic body of your project.
186 The body of your program should take the following form:
190 #include "SDL.h"
192 int main( int argc, char* argv[] )
194 // Body of the program goes here.
201 <H3> That's it! </H3>
204 I hope that this document has helped you get
205 through the most difficult part of using the
206 SDL: installing it. Suggestions for improvements
207 to this document should be sent to the writers
212 Thanks to Paulus Esterhazy (pesterhazy@gmx.net), for the work on VC++ port.
216 This document was originally called "VisualC.txt",
218 <A HREF="mailto:slouken@libsdl.org">Sam Lantinga</A>.
222 Later, it was converted to HTML and expanded into
223 the document that you see today by
224 <A HREF="mailto:snowlion@sprynet.com">Lion Kimbro</A>.