SDL2 Development Environment Construction
Development environment
Visual Studio 2012
Win8.1 64-bit
SDL2 Library and extension library URL and download library address
SDL2 Library
http://www.libsdl.org/download-2.0.php
Http://www.libsdl.org/release/SDL2-devel-2.0.3-VC.zip
Multi-channel Audio mixer Library
http://www.libsdl.org/projects/SDL_mixer/
Http://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-devel-2.0.0-VC.zip
Image File Loading Library
http://www.libsdl.org/projects/SDL_image/
Http://www.libsdl.org/projects/SDL_image/release/SDL2_image-devel-2.0.0-VC.zip
Please refer to the video to build SDL2 development environment
Copies of the 32-bit repositories, 64-bit repositories, and header files for the SDL, Sdl_mixer, and sdl_image libraries, respectively
Include:c:\program Files (x86) \microsoft Visual Studio 11.0\vc\include
32-bit DLL (64-bit system): C:\Windows\SysWOW64
64-bit DLL (64-bit system): C:\Windows\System32
32-bit DLL (32-bit system): C:\Windows\System32
32-bit LIB (64-bit system): C:\Program Files (x86) \microsoft Visual Studio 11.0\vc\lib
64-bit Lib (64-bit system): C:\Program Files (x86) \microsoft Visual Studio 11.0\vc\lib\amd64
Add the SDL2.lib sdl2_mixer.lib sdl2_image.lib SDL2main.lib Import Library by adding an additional dependency, such as the linker, input, properties, configuration properties, and so on.
Select the multithreaded DLL (/MD) in and in the Run library, properties---Configuration properties,->c/c++-> code generation,
The following is the test code when the console prints "Info:ok." Indicates successful deployment
#include <stdlib.h> #include <stdio.h> #include "SDL.h" #include "sdl_image.h" # include "Sdl_thread.h" #include "Sdl_mixer.h" #define buffer 1024int main (INT&NBSP;ARGC , &NBSP;CHAR**&NBSP;ARGV) {int initted; Sdl_logsetpriority (Sdl_log_category_application, sdl_log_priority_info);if (SDL_Init (SDL_INIT_ Everything) == -1) {sdl_logerror (sdl_log_category_application, "Could not initialize sdl. "); Exit (-2);} if (Img_init (img_init_png) == -1) {sdl_logerror (sdl_log_category_application, ) Could Not initialize sdl img. "); Exit (-2);} Initted = mix_init (0); Initted = mix_init (~0); Mix_quit ();if (Mix_openaudio (44100, mix_default_format, 2, buffer) < 0) {SDL_ LogError (sdl_log_category_application, "mix_openaudio error."); Exit (-2);} Sdl_loginfo (sdl_log_category_application, "OK."); Mix_closeaudio (); Img_quit ();Sdl_quit (); return 0;}
SDL2 Development Environment Setup