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