-
Notifications
You must be signed in to change notification settings - Fork 1
Setting up SDL
Your best bet is to use LazyFoo, in the Helpful Links section.
You can try these...
- Compile or acquire
SDL.lib
,SDLmain.lib
,SDL.dll
- Make a VS Empty Project
- Add your sources/headers
- Open 'Project Properties'
- 'C/C++' -> 'General' -> 'Additional Include Directories' :
*path to*/SDL/includes
- 'Linker' -> 'Input' -> 'Additional Dependencies' :
*path to*/SDL/VisualC/SDL/Win32/Debug/SDL.lib
,*path to*/SDL/VisualC/SDLmain/Win32/Debug/SDLmain.lib
,OpenGL32.lib
- 'Linker' -> 'Advanced' -> 'Entry Point' :
main
- Compile or acquire
SDL.framework
- Create a new XCode Application->Console Tool Project
- Add your sources/headers
- Click on the project title
- Click on the only Target
- Add all your sources to 'Compile Sources'
- Open 'Link Binary With Libraries'
- Add
SDL.framework
,OpenGL.framework
- Best to compile the sources yourself.
- g++ myfile.cpp -o myawesomeprogram -lGL $(sdl-config --cflags --libs)
Note that 'make install' in the 1.3 SDL libraries does not install them to the standard place. The header files are /usr/local/include and the libraries themselves are installed to /usr/local/lib. So, compiling and running might look like this (see: http://www.network-theory.co.uk/docs/gccintro/gccintro_25.html ):
- (First, add a new file to /etc/ld.so.conf.d/ that contains the line /usr/local/lib)
- g++ -L/usr/local/lib/ -lSDL -lGL SDLExample.cpp -o example
- LD_LIBRARY_PATH=/usr/local/lib
- export LD_LIBRARY_PATH
- ./example
It would be better to statically link the libraries.
Here's the text the displays when you install the library. Libraries have been installed in: /usr/local/lib
If you ever happen to want to link against installed libraries in a given directory, LIBDIR, you must either use libtool, and specify the full pathname of the library, or use the `-LLIBDIR' flag during linking and do at least one of the following:
- add LIBDIR to the `LD_LIBRARY_PATH' environment variable during execution
- add LIBDIR to the `LD_RUN_PATH' environment variable during linking
- use the `-Wl,-rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to `/etc/ld.so.conf'
See any operating system documentation about shared libraries for more information, such as the ld(1) and ld.so(8) manual pages.