comparison VisualC.html @ 0:74212992fb08

Initial revision
author Sam Lantinga <slouken@lokigames.com>
date Thu, 26 Apr 2001 16:45:43 +0000
parents
children 180837a1db89
comparison
equal deleted inserted replaced
-1:000000000000 0:74212992fb08
1 <HTML>
2
3
4
5 <HEAD>
6
7
8
9 <TITLE> Using SDL with Microsoft Visual C++ 5 and 6 </TITLE>
10
11
12
13 </HEAD>
14
15
16
17 <BODY>
18
19
20
21 <H1> Using SDL with Microsoft Visual C++ 5 and 6 </H1>
22
23 <H3>
24 by <A HREF="mailto:snowlion@sprynet.com"> Lion Kimbro </A>
25 </H3>
26
27
28
29 <p>
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.
34 </p>
35
36
37 <H3> Building SDL </H3>
38
39 <P>
40 Unzip the <CODE>VisualC.zip</CODE> file into the directory
41 that contains this file (<CODE>VisualC.html</CODE>).
42 </P>
43
44 <P>
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.
54 </P>
55
56 <P>
57 Now that it's unzipped, go into the VisualC directory
58 that is created, and double-click on the VC++
59 workspace file &quot;<CODE>SDL.dsw</CODE>&quot;.
60 This should open up VisualC.
61 </P>
62
63 <P>
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
67 upgraded.
68 </P>
69
70
71 <P>
72 Build the <CODE>.dll</CODE> and <CODE>.lib</CODE> files.
73 </P>
74
75 <P>
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 &quot;Build&quot;.
79 </P>
80
81 <P>
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>.
88 </P>
89
90 <P>
91 Later, we will refer to the following .lib and .dll
92 files that have just been generated:
93 </P>
94
95 <list>
96 <li> SDL.dll
97 <li> SDL.lib
98 <li> SDLmain.lib
99 </list>
100
101 <P>
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.)
110 </P>
111
112
113
114 <H3> Creating a Project with SDL </H3>
115
116 <P>
117 Create a project as a Win32 Application.
118 </P>
119
120 <P>
121 Create a C++ file for your project.
122 </P>
123
124 <P>
125 Set the C runtime to "Multi-threaded DLL" in the menu:
126 <CODE> Project|Settings|C/C++ tab|Code Generation|Runtime Library </CODE>.
127 </P>
128
129 <P>
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>.
133 </P>
134
135 <P>
136 The &quot;include directory&quot; I am referring to is the
137 <CODE>include</CODE> folder within the main SDL
138 directory (the one that this HTML file located
139 within.
140 </P>
141
142 <P>
143 Now we're going to use the files that we had created
144 earlier in the Build SDL step.
145 </P>
146
147 <P>
148 Copy the following files into your Project directory:
149 </P>
150
151 <list>
152 <li> SDL.dll </li>
153 </list>
154
155 <P>
156 Copy the following files into your Project directory,
157 and <em>add them to your Project</em> as well:
158 </P>
159
160 <list>
161 <li> SDL.lib </li>
162 <li> SDLmain.lib </li>
163 </list>
164
165 <P>
166 (To add them to your project, right click on your
167 project, and select &quot;Add files to project&quot;)
168 </P>
169
170 <P>
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">
176 e-mail me </A>,
177 and I'll fix this document.)
178 </P>
179
180
181
182 <H3> SDL 101, First Day of Class </H3>
183
184 <P>
185 Now create the basic body of your project.
186 The body of your program should take the following form:
187
188 <CODE>
189 <PRE>
190 #include &quot;SDL.h&quot;
191
192 int main( int argc, char* argv[] )
193 {
194 // Body of the program goes here.
195 return 0;
196 }
197 </PRE>
198 </CODE>
199 </P>
200
201 <H3> That's it! </H3>
202
203 <P>
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
208 of this document.
209 </P>
210
211 <P>
212 Thanks to Paulus Esterhazy (pesterhazy@gmx.net), for the work on VC++ port.
213 </P>
214
215 <P>
216 This document was originally called &quot;VisualC.txt&quot;,
217 and was written by
218 <A HREF="mailto:slouken@libsdl.org">Sam Lantinga</A>.
219 </P>
220
221 <P>
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>.
225 </P>
226
227
228
229 </BODY>
230
231
232
233 </HTML>
234
235