Advertisement
thecplusplusguy

Use OpenGL and SDL with Visual C++

Nov 30th, 2011
4,028
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.68 KB | None | 0 0
  1. How to setup SDL and Opengl on Visual Studio (2010 express, don't worry, if you have slightly different version).
  2. Step 1 - download the SDL, go to http://www.libsdl.org/download-1.2.php and download the library for Visual studio (SDL-devel-1.2.14-VC8.zip (Visual C++ 2005 Service Pack 1)) and uncompress it somewhere (just remember where)
  3. Step 2 - create a new project in Visual Studio (Win32 Consol application and empty project) and copy (or write the code in it)
  4. Step 3 - go to project/project_name properties and then VC++ directories and set your include directories (click on it, arrow on the right side/edit... and the new sign, and browse it) to the directiory you downloaded in step 1\include\ for example in my case it's (G:\include\SDL-1.2.14\include) and then do the same to the library directiories and the path should be the downloaded SDL directory/lib for example in my case it's G:\include\SDL-1.2.14\lib
  5. Step 4 - don't close this property windows and go to linker/input and edit the additional dependencies (just copy the followings):
  6. SDL.lib
  7. SDLmain.lib
  8. opengl32.lib
  9. glu32.lib
  10. Step 5 - Depend on the SDL version you will need to include SDL.h or SDL/SDL.h (check the include directory), and you have to include windows.h before you include the OpenGL header files.
  11. Step 6 - Copy the SDL.dll (from the SDL library, you downloaded) (and in case of project which use some other files like images and objs...)
  12. to your project directory\name\name\ (for example my project directory is: G:\Users\computer\Documents\Visual Studio 2010\Projects\)
  13. Step 6 - now you can run the program from Visual Studio copy the SDl.dll and the other files to projetct/name/debug, to be able to run the exe file.
  14.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement