comparison VisualC.html @ 521:136d97397288

Added Visual C++ 7 (.NET) projects (thanks James!)
author Sam Lantinga <slouken@libsdl.org>
date Tue, 08 Oct 2002 15:43:40 +0000
parents 180837a1db89
children e044e7c70a50
comparison
equal deleted inserted replaced
520:26eb0f877ce6 521:136d97397288
1 <HTML> 1 <HTML>
2 2 <HEAD>
3 3 <TITLE>Using SDL with Microsoft Visual C++</TITLE>
4 4 </HEAD>
5 <HEAD> 5 <BODY>
6 6 <H1>
7 7 Using SDL with Microsoft Visual C++ 5,6&nbsp;and 7
8 8 </H1>
9 <TITLE> Using SDL with Microsoft Visual C++ 5 and 6 </TITLE> 9 <H3>
10 10 by <A HREF="mailto:snowlion@sprynet.com">Lion Kimbro </A>and additions by <A HREF="mailto:james@conceptofzero.net">
11 11 James Turk</A>
12 12 </H3>
13 </HEAD> 13 <p>
14 14 You can either use the precompiled libraries from <A HREF="http://www.libsdl.org/download.php">
15 15 the SDL Download web site </A>, or you can build SDL yourself.
16 16 </p>
17 <BODY> 17 <H3>
18 18 Building SDL
19 19 </H3>
20 20 <P>
21 <H1> Using SDL with Microsoft Visual C++ 5 and 6 </H1> 21 Unzip the <CODE>VisualC.zip</CODE> file into the directory that contains this
22 22 file (<CODE>VisualC.html</CODE>). <STRONG><FONT color="#009900">If you are using Visual
23 <H3> 23 C++ 7 (.NET) you will need to use the file <code>VisualC7.zip.</code></FONT></STRONG>
24 by <A HREF="mailto:snowlion@sprynet.com"> Lion Kimbro </A> 24 </P>
25 </H3> 25 <P>
26 26 Be certain that you unzip the zip file for your compiler into <strong>this</strong>
27 27 directory and not any other directory. If you are using WinZip, be careful to
28 28 make sure that it extracts to <strong>this</strong> folder, because it's
29 <p> 29 convenient feature of unzipping to a folder with the name of the file currently
30 You can either use the precompiled libraries from 30 being unzipped will get you in trouble if you use it right now. And that's all
31 <A HREF="http://www.libsdl.org/download.php"> 31 I have to say about that.
32 the SDL Download web site </A>, 32 </P>
33 or you can build SDL yourself. 33 <P>
34 </p> 34 Now that it's unzipped, go into the VisualC <STRONG><FONT color="#009900">(VisualC7)</FONT></STRONG>
35 35 directory that is created, and double-click on the VC++ file "<CODE>SDL.dsw</CODE>"<STRONG><FONT color="#009900">
36 36 ("<CODE>SDL.sln</CODE>").</FONT></STRONG> This should open up the IDE.
37 <H3> Building SDL </H3> 37 </P>
38 38 <P>
39 <P> 39 You may be prompted at this point to upgrade the workspace, should you be using
40 Unzip the <CODE>VisualC.zip</CODE> file into the directory 40 a more recent version of Visual C++. If so, allow the workspace to be upgraded.
41 that contains this file (<CODE>VisualC.html</CODE>). 41 </P>
42 </P> 42 <P>
43 43 Build the <CODE>.dll</CODE> and <CODE>.lib</CODE> files.
44 <P> 44 </P>
45 Be certain that you unzip <CODE> VisualC.zip </CODE> 45 <P>
46 into <strong>this</strong> directory and not any other 46 This is done by right clicking on each project in turn (Projects are listed in
47 directory. If you are using WinZip, be careful to 47 the Workspace panel in the FileView tab), and selecting "Build".
48 make sure that it extracts to <strong>this</strong> 48 </P>
49 folder, because it's convenient feature of 49 <P>
50 unzipping to a folder with the name of the 50 You may get a few warnings, but you should not get any errors. You do have to
51 file currently being unzipped will get you in 51 have at least the DirectX 5 SDK installed, however. The latest
52 trouble if you use it right now. And that's all 52 version of DirectX can be downloaded or purchased on a cheap CD (my
53 I have to say about that. 53 recommendation) from <A HREF="http://www.microsoft.com">Microsoft </A>.
54 </P> 54 </P>
55 55 <P>
56 <P> 56 Later, we will refer to the following .lib and .dll files that have just been
57 Now that it's unzipped, go into the VisualC directory 57 generated:
58 that is created, and double-click on the VC++ 58 </P>
59 workspace file &quot;<CODE>SDL.dsw</CODE>&quot;. 59 <ul>
60 This should open up VisualC. 60 <li> SDL.dll</li>
61 </P> 61 <li> SDL.lib</li>
62 62 <li> SDLmain.lib</li>
63 <P> 63 </ul>
64 You may be prompted at this point to upgrade the 64 <P>
65 workspace, should you be using a more recent version 65 Search for these using the Windows Find (Windows-F) utility, if you don't
66 of Visual C++. If so, allow the workspace to be 66 already know where they should be. For those of you with a clue, look inside
67 upgraded. 67 the Debug or Release directories of the subdirectories of the Project folder.
68 </P> 68 (It might be easier to just use Windows Find if this sounds confusing. And
69 69 don't worry about needing a clue; we all need visits from the clue fairy
70 70 frequently.)
71 <P> 71 </P>
72 Build the <CODE>.dll</CODE> and <CODE>.lib</CODE> files. 72 <H3>
73 </P> 73 Creating a Project with SDL
74 74 </H3>
75 <P> 75 <P>
76 This is done by right clicking on each project in turn 76 Create a project as a Win32 Application.
77 (Projects are listed in the Workspace panel in the 77 </P>
78 FileView tab), and selecting &quot;Build&quot;. 78 <P>
79 </P> 79 Create a C++ file for your project.
80 80 </P>
81 <P> 81 <P>
82 You may get a few warnings, but you should not get 82 Set the C runtime to "Multi-threaded DLL" in the menu: <CODE>Project|Settings|C/C++
83 any errors. You do have to have at least the DirectX 83 tab|Code Generation|Runtime Library </CODE>.
84 5 SDK installed, however. (I believe...) The latest 84 </P>
85 version of DirectX can be downloaded or purchased 85 <P>
86 on a cheap CD (my recommendation) from 86 Add the SDL <CODE>include</CODE> directory to your list of includes in the
87 <A HREF="http://www.microsoft.com"> Microsoft </A>. 87 menu: <CODE>Project|Settings|C/C++ tab|Preprocessor|Additional include directories </CODE>
88 </P> 88 .
89 89 <br>
90 <P> 90 <STRONG><FONT color="#009900">VC7 Specific: Instead of doing this I find it easier to
91 Later, we will refer to the following .lib and .dll 91 add the include and library directories to the list that VC7 keeps. Do this by
92 files that have just been generated: 92 selecting Tools|Options|Projects|VC++ Directories and under the "Show
93 </P> 93 Directories For:" dropbox select "Include Files", and click the "New Directory
94 94 Icon" and add the [SDLROOT]\include directory (ex. If you installed to
95 <list> 95 c:\SDL-1.2.5\ add c:\SDL-1.2.5\include).&nbsp;Proceed to&nbsp;change the
96 <li> SDL.dll 96 dropbox selection to "Library Files" and add [SDLROOT]\lib.</FONT></STRONG>
97 <li> SDL.lib 97 </P>
98 <li> SDLmain.lib 98 <P>
99 </list> 99 The "include directory" I am referring to is the <CODE>include</CODE> folder
100 100 within the main SDL directory (the one that this HTML file located within).
101 <P> 101 </P>
102 Search for these using the Windows Find (Windows-F) 102 <P>
103 utility, if you don't already know where they should be. 103 Now we're going to use the files that we had created earlier in the Build SDL
104 For those of you with a clue, look inside the Debug 104 step.
105 or Release directories of the subdirectories of the 105 </P>
106 VisualC folder. (It might be easier to just use 106 <P>
107 Windows Find if this sounds confusing. And don't worry 107 Copy the following files into your Project directory:
108 about needing a clue; we all need visits from the 108 </P>
109 clue fairy frequently.) 109 <ul>
110 </P> 110 <li> SDL.dll</li>
111 111 </ul>
112 112 <P>
113 113 Add the following files to your project (It is not necessary to copy them to
114 <H3> Creating a Project with SDL </H3> 114 your project directory):
115 115 </P>
116 <P> 116 <ul>
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> 117 <li> SDL.lib </li>
162 <li> SDLmain.lib </li> 118 <li> SDLmain.lib</li>
163 </list> 119 </ul>
164 120 <P>
165 <P> 121 (To add them to your project, right click on your project, and select "Add
166 (To add them to your project, right click on your 122 files to project")
167 project, and select &quot;Add files to project&quot;) 123 </P>
168 </P> 124 <P><STRONG><FONT color="#009900">Instead of adding the files to your project it is more
169 125 desireable to add them to the linker options: Project|Properties|Linker|Command
170 <P> 126 Line and type the names of the libraries to link with in the "Additional
171 (I believe that it's not necessary to actually 127 Options:" box.&nbsp; Note: This must be done&nbsp;for&nbsp;each&nbsp;build
172 copy the .lib files into your directory; you only 128 configuration (eg. Release,Debug).</FONT></STRONG></P>
173 have to be certain that you add them to your Project. 129 <H3>
174 If someone is so inclined, correct this document, or 130 SDL 101, First Day of Class
175 <A HREF="mailto:snowlion@sprynet.com"> 131 </H3>
176 e-mail me </A>, 132 <P>
177 and I'll fix this document.) 133 Now create the basic body of your project. The body of your program should take
178 </P> 134 the following form: <CODE>
179 135 <PRE>
180 136 #include "SDL.h"
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 137
192 int main( int argc, char* argv[] ) 138 int main( int argc, char* argv[] )
193 { 139 {
194 // Body of the program goes here. 140 // Body of the program goes here.
195 return 0; 141 return 0;
196 } 142 }
197 </PRE> 143 </PRE>
198 </CODE> 144 </CODE>
199 </P> 145 <P></P>
200 146 <H3>
201 <H3> That's it! </H3> 147 That's it!
202 148 </H3>
203 <P> 149 <P>
204 I hope that this document has helped you get 150 I hope that this document has helped you get through the most difficult part of
205 through the most difficult part of using the 151 using the SDL: installing it. Suggestions for improvements to this document
206 SDL: installing it. Suggestions for improvements 152 should be sent to the writers of this document.
207 to this document should be sent to the writers 153 </P>
208 of this document. 154 <P>
209 </P> 155 Thanks to Paulus Esterhazy (pesterhazy@gmx.net), for the work on VC++ port.
210 156 </P>
211 <P> 157 <P>
212 Thanks to Paulus Esterhazy (pesterhazy@gmx.net), for the work on VC++ port. 158 This document was originally called "VisualC.txt", and was written by <A HREF="mailto:slouken@libsdl.org">
213 </P> 159 Sam Lantinga</A>.
214 160 </P>
215 <P> 161 <P>
216 This document was originally called &quot;VisualC.txt&quot;, 162 Later, it was converted to HTML and expanded into the document that you see
217 and was written by 163 today by <A HREF="mailto:snowlion@sprynet.com">Lion Kimbro</A>.
218 <A HREF="mailto:slouken@libsdl.org">Sam Lantinga</A>. 164 </P>
219 </P> 165 <P>Minor Fixes and Visual C++ 7 Information (In Green) was added by <A HREF="mailto:james@conceptofzero.net">James Turk</A>
220 166 </P>
221 <P> 167 </BODY>
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> 168 </HTML>
234
235