Table Of Contents
- What is supported?
- I'm running Windows 2000 and I can't copy SDL.dll!
- Can I build SDL for Windows CE?
- How do I use SDL with Visual C++?
- When using Visual C++ I get link errors relating to MSVCRT.LIB or LIBC
- Why can't I use Visual C++ debugger with SDL applications?
- How do I use SDL with gcc on Windows?
- How do I use SDL with free Borland C++?
- How do I use SDL with Borland C++ Builder?
- How do I use SDL with Dev-C++?
- I get "Undefined reference to 'SDL_main'" ...
Q: What is supported? A: SDL supports Windows 95/98/NT/ME/2000/XP. SDL can be built with Visual C++, Cygwin, MinGW, Borland C++, Dev-C++, and Watcom C++.
SDL takes advantage of DirectX hardware acceleration when it is available, but falls back to the standard Win32 services if DirectX is not installed.
Q: I'm running Windows 2000 and I can't copy SDL.dll! A: For some reason, archives created on Linux have the "Encrypted" property set when unpacked on Windows 2000. This can be unset by pushing Advanced from the General tab of the properties window and unchecking Encrypt contents checkbox. The files are then normal and can be copied.
Q: Can I build SDL for Windows CE? A: SDL is not officially supported on Windows CE, but some people have successfully built and run SDL applications on Windows CE. You can play with building SDL for WinCE if you have the WinCE SDK and grab the following files:
http://www.libsdl.org/cvs/WinCE.txt
http://www.libsdl.org/cvs/WinCE-SDL.zip
The text file contains a list of the missing functionality in WinCE, and the ZIP file contains a build project for SDL on WinCE for the MIPS processor. Just unpack it in the main SDL directory.
Q: How do I use SDL with Visual C++? A: Read the file "VisualC.html" included with both the SDL Visual C++ development archive, and the SDL source distribution.
Q: When using Visual C++ I get link errors relating to MSVCRT.LIB or LIBC A: SDL is dynamically linked with the multi-threaded version of the Microsoft Visual C runtime. You need to edit your project settings, go to the C++ language tab, change the listbox to "Code Generation" settings, and then change the runtime library to "Multi-threaded DLL". Make sure you do this with all projects that you link into your application.
Q: Why can't I use Visual C++ debugger with SDL applications? A: You need to pass the SDL_INIT_NOPARACHUTE flag to your calls to SDL_Init() to make the msvc debugger work. Otherwise the debugger will be unable to trace exceptions, and other debugging features like run to cursor won't work.
Q: How do I use SDL with gcc on Windows? A: You can build and use SDL with gcc natively using either Cygwin or MinGW, or you can build a gcc cross-compiler targeting Windows from another platform.
Setting up these environments is documented at: http://www.libsdl.org/extras/win32/gcc.html
Once the build environment is set up, you can build your applications as though you are on UNIX. See the Linux FAQ for more details on building applications in this environment.
Q: How do I use SDL with free Borland C++? A: This howto was contributed by Chris Dion:
Here's a step-by-step run through of what I did. I haven't used .dll's and such before, so you'll have to excuse me if I'm not using the right terminology.
- Run the IMPLIB utility on SDL.DLL to make a new SDL.LIB import library. Use the -a and -c switches.
- You still need the SDL_MAIN.LIB file, so that you don't need to define WinMain() and all that junky windows stuff. You have no .dll file to build this .lib from, and COFF2OMF creates a empty .lib (you can check with TDUMP, another utillity that comes with the compiler). Get the Win32 version of the SDL_main.c file from the source, and dump it in with the rest of your project,
- Compile your source (including SDL_main.c) into object files using BCC32 with the following compiler options:
-c
(Don't link)
-tW
(Create windows app)
-DWIN32
(Define WIN32, this is needed in the SDL_main.h file, and maybe others)
- Link the.obj files together using ILINK32 with the following options:
-aa
(Create windows app, sounds redundant, but...)
-Tpe
(Target = windows exe)
-c
(case sensitive linking, may be the default...)
and the following additional files (order is important)
sdl.lib
(created in step 1)import32.lib
c0w32.obj
cw32.lib
If all goes well, you should have a working .exe file. The help files that come with the command line tools are missing detailed descriptions of the various compiler/linker switches. You can download a complete help file from the Borland ftp site here:
ftp://ftp.borland.com/pub/bcppbuilder/techpubs/bcb5/b5std.zip
Q: How do I use SDL with Borland C++ Builder? A: Here are some instructions and examples contributed by Alessandro Porcu: SDL_borland3.zip Martin Bickel writes:
For both Watcom C/C++ and Borland C/C++ the compiler option that makes enums having the size of an int must be enabled. This is "-b" for Borland C/C++ and "-ei" for Watcom C/C++ (v11).
Q: How do I use SDL with Dev-C++? A: Try the Dev-C++ tutorial available at: http://cone3d.gamedev.net/cgi-bin/index.pl?page=tutorials/gfxsdl/tut1.
If you have problems, please contact the author of the tutorial. There are also step by step instructions at: http://docs.deninet.com/sdl_on_dev_c.htm
Q: I get "Undefined reference to 'SDL_main'" ... A: Make sure that you are declaring main() as: #include "SDL.h" int main(int argc, char *argv[])You should be using main() instead of WinMain() even though you are creating a Windows application, because SDL provides a version of WinMain() which performs some SDL initialization before calling your main code. If for some reason you need to use WinMain(), take a look at the SDL source code in src/main/win32/SDL_main.c to see what kind of initialization you need to do in your WinMain() function so that SDL works properly.