SDL2 | Cygwin环境下编译、安装SDL2

Cygwin环境下编译、安装SDL2

说明

主机环境:window10 专业版、cygwin

1.解压SDL2源码

压缩包:SDL2-2.0.16.zip

2.编译、安装SDL2

启动mintty.exe(cygwin的执行终端)

::启动脚本
set TOP_DIR=%cd%
cd  .\
::set path=C:\NMake;%path%
start D:\softwareTools\DesTools\Cygwin64\bin\mintty.exe

配置LOG信息:


lanfeiy@yelanfei /cygdrive/e/fly-prj/SDL2/SDL2-2.0.16
$ ./configure
checking build system type... x86_64-pc-cygwin
checking host system type... x86_64-pc-cygwin
checking how to print strings... printf
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.exe
checking for suffix of executables... .exe
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for a sed that does not truncate output... /usr/bin/sed
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for fgrep... /usr/bin/grep -F
checking for ld used by gcc... /usr/x86_64-pc-cygwin/bin/ld.exe
checking if the linker (/usr/x86_64-pc-cygwin/bin/ld.exe) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 8192
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking how to convert x86_64-pc-cygwin file names to x86_64-pc-cygwin format... func_convert_file_noop
checking how to convert x86_64-pc-cygwin file names to toolchain format... func_convert_file_noop
checking for /usr/x86_64-pc-cygwin/bin/ld.exe option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... dlltool
checking how to associate runtime and link libraries... func_cygming_dll_for_implib
checking for ar... ar
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking for gawk... gawk
checking command to parse /usr/bin/nm -B output from gcc object... failed
checking for sysroot... no
checking for mt... no
checking if : is a manifest tool... no
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for as... as
checking for dlltool... (cached) dlltool
checking for objdump... (cached) objdump
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -DDLL_EXPORT -DPIC
checking if gcc PIC flag -DDLL_EXPORT -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/x86_64-pc-cygwin/bin/ld.exe) supports shared libraries... yes
checking whether -lc should be explicitly linked in... yes
checking dynamic linker characteristics... Win32 ld.exe
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking for windres... windres
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking how to run the C++ preprocessor... g++ -E
checking for ld used by g++... /usr/x86_64-pc-cygwin/bin/ld.exe
checking if the linker (/usr/x86_64-pc-cygwin/bin/ld.exe) is GNU ld... yes
checking whether the g++ linker (/usr/x86_64-pc-cygwin/bin/ld.exe) supports shared libraries... yes
checking for g++ option to produce PIC... -DDLL_EXPORT -DPIC
checking if g++ PIC flag -DDLL_EXPORT -DPIC works... yes
checking if g++ static flag -static works... yes
checking if g++ supports -c -o file.o... yes
checking if g++ supports -c -o file.o... (cached) yes
checking whether the g++ linker (/usr/x86_64-pc-cygwin/bin/ld.exe) supports shared libraries... yes
checking dynamic linker characteristics... Win32 ld.exe
checking how to hardcode library paths into programs... immediate
checking for a BSD-compatible install... /usr/bin/install -c
checking whether make sets $(MAKE)... yes
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for GCC -mno-cygwin option... no
checking for an ANSI C-conforming const... yes
checking for inline... inline
checking for working volatile... yes
checking for GCC -MMD -MT option... yes
checking for linker option --no-undefined... yes
checking for linker option --dynamicbase... yes
checking for linker option --nxcompat... yes
checking for linker option --high-entropy-va... yes
checking for ANSI C header files... (cached) yes
checking for sys/types.h... (cached) yes
checking stdio.h usability... yes
checking stdio.h presence... yes
checking for stdio.h... yes
checking for stdlib.h... (cached) yes
checking stddef.h usability... yes
checking stddef.h presence... yes
checking for stddef.h... yes
checking stdarg.h usability... yes
checking stdarg.h presence... yes
checking for stdarg.h... yes
checking malloc.h usability... yes
checking malloc.h presence... yes
checking for malloc.h... yes
checking for memory.h... (cached) yes
checking for string.h... (cached) yes
checking for strings.h... (cached) yes
checking wchar.h usability... yes
checking wchar.h presence... yes
checking for wchar.h... yes
checking for inttypes.h... (cached) yes
checking for stdint.h... (cached) yes
checking limits.h usability... yes
checking limits.h presence... yes
checking for limits.h... yes
checking ctype.h usability... yes
checking ctype.h presence... yes
checking for ctype.h... yes
checking math.h usability... yes
checking math.h presence... yes
checking for math.h... yes
checking float.h usability... yes
checking float.h presence... yes
checking for float.h... yes
checking iconv.h usability... no
checking iconv.h presence... no
checking for iconv.h... no
checking signal.h usability... yes
checking signal.h presence... yes
checking for signal.h... yes
checking for size_t... yes
checking for M_PI in math.h... yes
checking for working memcmp... yes
checking for working strtod... yes
checking for mprotect... yes
checking for malloc... yes
checking for calloc... yes
checking for realloc... yes
checking for free... yes
checking for getenv... yes
checking for setenv... yes
checking for putenv... yes
checking for unsetenv... yes
checking for qsort... yes
checking for abs... yes
checking for bcopy... yes
checking for memset... yes
checking for memcpy... yes
checking for memmove... yes
checking for wcslen... yes
checking for wcslcpy... yes
checking for wcslcat... yes
checking for _wcsdup... no
checking for wcsdup... yes
checking for wcsstr... yes
checking for wcscmp... yes
checking for wcsncmp... yes
checking for wcscasecmp... yes
checking for _wcsicmp... no
checking for wcsncasecmp... yes
checking for _wcsnicmp... no
checking for strlen... yes
checking for strlcpy... yes
checking for strlcat... yes
checking for _strrev... no
checking for _strupr... no
checking for _strlwr... no
checking for index... yes
checking for rindex... yes
checking for strchr... yes
checking for strrchr... yes
checking for strstr... yes
checking for strtok_r... yes
checking for itoa... no
checking for _ltoa... no
checking for _uitoa... no
checking for _ultoa... no
checking for strtol... yes
checking for strtoul... yes
checking for _i64toa... no
checking for _ui64toa... no
checking for strtoll... yes
checking for strtoull... yes
checking for atoi... yes
checking for atof... yes
checking for strcmp... yes
checking for strncmp... yes
checking for _stricmp... no
checking for strcasecmp... yes
checking for _strnicmp... no
checking for strncasecmp... yes
checking for vsscanf... yes
checking for vsnprintf... yes
checking for fopen64... no
checking for fseeko... yes
checking for fseeko64... no
checking for sigaction... yes
checking for setjmp... yes
checking for nanosleep... yes
checking for sysconf... yes
checking for sysctlbyname... no
checking for getauxval... no
checking for elf_aux_info... no
checking for poll... yes
checking for _Exit... yes
checking for pow in -lm... yes
checking for acos... yes
checking for acosf... yes
checking for asin... yes
checking for asinf... yes
checking for atan... yes
checking for atanf... yes
checking for atan2... yes
checking for atan2f... yes
checking for ceil... yes
checking for ceilf... yes
checking for copysign... yes
checking for copysignf... yes
checking for cos... yes
checking for cosf... yes
checking for exp... yes
checking for expf... yes
checking for fabs... yes
checking for fabsf... yes
checking for floor... yes
checking for floorf... yes
checking for trunc... yes
checking for truncf... yes
checking for fmod... yes
checking for fmodf... yes
checking for log... yes
checking for logf... yes
checking for log10... yes
checking for log10f... yes
checking for lround... yes
checking for lroundf... yes
checking for pow... yes
checking for powf... yes
checking for round... yes
checking for roundf... yes
checking for scalbn... yes
checking for scalbnf... yes
checking for sin... yes
checking for sinf... yes
checking for sqrt... yes
checking for sqrtf... yes
checking for tan... yes
checking for tanf... yes
checking for iconv_open in -liconv... no
checking for iconv... no
checking for struct sigaction.sa_sigaction... yes
checking libunwind.h usability... no
checking libunwind.h presence... no
checking for libunwind.h... no
checking for GCC builtin atomic operations... yes
checking for GCC -mmmx option... yes
checking for GCC -m3dnow option... yes
checking for GCC -msse option... yes
checking for GCC -msse2 option... yes
checking for GCC -msse3 option... yes
checking for immintrin.h... yes
checking for Altivec with GCC altivec.h and -maltivec option... no
checking for Altivec with GCC -maltivec option... no
checking for Altivec with GCC altivec.h and -faltivec option... no
checking for Altivec with GCC -faltivec option... no
checking for GCC -Wall option... yes
checking for necessary GCC -Wno-multichar option... no
checking for GCC -fno-strict-aliasing option... yes
checking for GCC -Wdeclaration-after-statement option... yes
checking Windows compiler... yes
checking Windows CE... no
checking for GCC -mpreferred-stack-boundary option... no
checking for EGL support... no
checking for OpenGL ES v2 headers... yes
checking d3d9.h usability... no
checking d3d9.h presence... yes
configure: WARNING: d3d9.h: present but cannot be compiled
configure: WARNING: d3d9.h:     check for missing prerequisite headers?
configure: WARNING: d3d9.h: see the Autoconf documentation
configure: WARNING: d3d9.h:     section "Present But Cannot Be Compiled"
configure: WARNING: d3d9.h: proceeding with the compiler's result
checking for d3d9.h... no
checking d3d11_1.h usability... yes
checking d3d11_1.h presence... yes
checking for d3d11_1.h... yes
checking ddraw.h usability... no
checking ddraw.h presence... yes
configure: WARNING: ddraw.h: present but cannot be compiled
configure: WARNING: ddraw.h:     check for missing prerequisite headers?
configure: WARNING: ddraw.h: see the Autoconf documentation
configure: WARNING: ddraw.h:     section "Present But Cannot Be Compiled"
configure: WARNING: ddraw.h: proceeding with the compiler's result
checking for ddraw.h... no
checking dsound.h usability... no
checking dsound.h presence... yes
configure: WARNING: dsound.h: present but cannot be compiled
configure: WARNING: dsound.h:     check for missing prerequisite headers?
configure: WARNING: dsound.h: see the Autoconf documentation
configure: WARNING: dsound.h:     section "Present But Cannot Be Compiled"
configure: WARNING: dsound.h: proceeding with the compiler's result
checking for dsound.h... no
checking dinput.h usability... no
checking dinput.h presence... yes
configure: WARNING: dinput.h: present but cannot be compiled
configure: WARNING: dinput.h:     check for missing prerequisite headers?
configure: WARNING: dinput.h: see the Autoconf documentation
configure: WARNING: dinput.h:     section "Present But Cannot Be Compiled"
configure: WARNING: dinput.h: proceeding with the compiler's result
checking for dinput.h... no
checking dxgi.h usability... yes
checking dxgi.h presence... yes
checking for dxgi.h... yes
checking xinput.h usability... yes
checking xinput.h presence... yes
checking for xinput.h... yes
checking for struct XINPUT_GAMEPAD_EX... no
checking for struct XINPUT_STATE_EX... no
checking mmdeviceapi.h usability... yes
checking mmdeviceapi.h presence... yes
checking for mmdeviceapi.h... yes
checking audioclient.h usability... yes
checking audioclient.h presence... yes
checking for audioclient.h... yes
checking for hidapi support... yes
checking sensorsapi.h usability... yes
checking sensorsapi.h presence... yes
checking for sensorsapi.h... yes
checking for main in -lmingw32... no
checking whether to install sdl2-config... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating sdl2-config
config.status: creating sdl2-config.cmake
config.status: creating sdl2-config-version.cmake
config.status: creating SDL2.spec
config.status: creating sdl2.pc
config.status: creating include/SDL_config.h
config.status: executing libtool commands
config.status: executing sdl2_config commands
config.status: executing summary commands
SDL2 Configure Summary:
Building Shared Libraries
Building Static Libraries
Enabled modules : atomic audio video render events joystick haptic sensor power filesystem threads timers file loadso cpuinfo assembly
Assembly Math   : mmx 3dnow sse sse2 sse3
Audio drivers   : disk dummy winmm wasapi
Video drivers   : dummy opengl opengl_es2 vulkan d3d11
Input drivers   :
Enable virtual joystick APIs : YES
Using libsamplerate : NO
Using libudev       : NO
Using dbus          : NO
Using ime           : NO
Using ibus          : NO
Using fcitx         : NO
输入记录超过最大长度。请指定更大的最大限度。


lanfeiy@yelanfei /cygdrive/e/fly-prj/SDL2/SDL2-2.0.16
$

编译:

lanfeiy@yelanfei /cygdrive/e/fly-prj/SDL2/SDL2-2.0.16
$ make
/bin/sh build-scripts/updaterev.sh
/bin/sh build-scripts/mkinstalldirs build
mkdir -p -- build
touch build/.created
  CC     build/SDL.lo
  CC     build/SDL_assert.lo
  CC     build/SDL_dataqueue.lo
  CC     build/SDL_error.lo
  CC     build/SDL_hints.lo
  CC     build/SDL_log.lo
  CC     build/SDL_atomic.lo
  CC     build/SDL_spinlock.lo
  CC     build/SDL_audio.lo
  CC     build/SDL_audiocvt.lo
  CC     build/SDL_audiodev.lo
  CC     build/SDL_audiotypecvt.lo
  CC     build/SDL_mixer.lo
  CC     build/SDL_wave.lo
  CC     build/SDL_cpuinfo.lo
  CC     build/SDL_dynapi.lo
  CC     build/SDL_clipboardevents.lo
  CC     build/SDL_displayevents.lo
  CC     build/SDL_dropevents.lo
  CC     build/SDL_events.lo
/cygdrive/e/fly-prj/SDL2/SDL2-2.0.16/src/events/SDL_events.c: In function 'SDL_LogEvent':
/cygdrive/e/fly-prj/SDL2/SDL2-2.0.16/src/events/SDL_events.c:336:53: warning: format '%d' expects argument of type 'int', but argument 5 has type 'long long int' [-Wformat=]
  336 |             SDL_snprintf(details, sizeof (details), " (timestamp=%u touchid=%"SDL_PRIs64" fingerid=%"SDL_PRIs64" x=%f y=%f dx=%f dy=%f pressure=%f)", \
      |                                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~
  337 |                 (uint) event->tfinger.timestamp, (long long)event->tfinger.touchId, \
      |                                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                  |
      |                                                  long long int
/cygdrive/e/fly-prj/SDL2/SDL2-2.0.16/src/events/SDL_events.c:340:40: note: in expansion of macro 'PRINT_FINGER_EVENT'
  340 |         SDL_EVENT_CASE(SDL_FINGERDOWN) PRINT_FINGER_EVENT(event); break;
      |                                        ^~~~~~~~~~~~~~~~~~
/cygdrive/e/fly-prj/SDL2/SDL2-2.0.16/src/events/SDL_events.c:38:25: note: format string is defined here
   38 | #define SDL_PRIs64  "I64d"
      |                         ^
      |                         |
      |                         int
/cygdrive/e/fly-prj/SDL2/SDL2-2.0.16/src/events/SDL_events.c:336:53: warning: format '%d' expects argument of type 'int', but argument 6 has type 'long long int' [-Wformat=]
  336 |             SDL_snprintf(details, sizeof (details), " (timestamp=%u touchid=%"SDL_PRIs64" fingerid=%"SDL_PRIs64" x=%f y=%f dx=%f dy=%f pressure=%f)", \
      |                                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~
  337 |                 (uint) event->tfinger.timestamp, (long long)event->tfinger.touchId, \
  338 |                 (long long)event->tfinger.fingerId, event->tfinger.x, event->tfinger.y, \
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                 |
      |                 long long int
/cygdrive/e/fly-prj/SDL2/SDL2-2.0.16/src/events/SDL_events.c:340:40: note: in expansion of macro 'PRINT_FINGER_EVENT'
  340 |         SDL_EVENT_CASE(SDL_FINGERDOWN) PRINT_FINGER_EVENT(event); break;
      |                                        ^~~~~~~~~~~~~~~~~~
/cygdrive/e/fly-prj/SDL2/SDL2-2.0.16/src/events/SDL_events.c:38:25: note: format string is defined here
   38 | #define SDL_PRIs64  "I64d"
      |                         ^
      |                         |
      |                         int
/cygdrive/e/fly-prj/SDL2/SDL2-2.0.16/src/events/SDL_events.c:336:53: warning: format '%d' expects argument of type 'int', but argument 5 has type 'long long int' [-Wformat=]
  336 |             SDL_snprintf(details, sizeof (details), " (timestamp=%u touchid=%"SDL_PRIs64" fingerid=%"SDL_PRIs64" x=%f y=%f dx=%f dy=%f pressure=%f)", \
      |                                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~
  337 |                 (uint) event->tfinger.timestamp, (long long)event->tfinger.touchId, \
      |                                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                  |
      |                                                  long long int
/cygdrive/e/fly-prj/SDL2/SDL2-2.0.16/src/events/SDL_events.c:341:38: note: in expansion of macro 'PRINT_FINGER_EVENT'
  341 |         SDL_EVENT_CASE(SDL_FINGERUP) PRINT_FINGER_EVENT(event); break;
      |                                      ^~~~~~~~~~~~~~~~~~
/cygdrive/e/fly-prj/SDL2/SDL2-2.0.16/src/events/SDL_events.c:38:25: note: format string is defined here
   38 | #define SDL_PRIs64  "I64d"
      |                         ^
      |                         |
      |                         int
/cygdrive/e/fly-prj/SDL2/SDL2-2.0.16/src/events/SDL_events.c:336:53: warning: format '%d' expects argument of type 'int', but argument 6 has type 'long long int' [-Wformat=]
  336 |             SDL_snprintf(details, sizeof (details), " (timestamp=%u touchid=%"SDL_PRIs64" fingerid=%"SDL_PRIs64" x=%f y=%f dx=%f dy=%f pressure=%f)", \
      |                                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~
  337 |                 (uint) event->tfinger.timestamp, (long long)event->tfinger.touchId, \
  338 |                 (long long)event->tfinger.fingerId, event->tfinger.x, event->tfinger.y, \
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                 |
      |                 long long int
/cygdrive/e/fly-prj/SDL2/SDL2-2.0.16/src/events/SDL_events.c:341:38: note: in expansion of macro 'PRINT_FINGER_EVENT'
  341 |         SDL_EVENT_CASE(SDL_FINGERUP) PRINT_FINGER_EVENT(event); break;
      |                                      ^~~~~~~~~~~~~~~~~~
/cygdrive/e/fly-prj/SDL2/SDL2-2.0.16/src/events/SDL_events.c:38:25: note: format string is defined here
   38 | #define SDL_PRIs64  "I64d"
      |                         ^
      |                         |
      |                         int
/cygdrive/e/fly-prj/SDL2/SDL2-2.0.16/src/events/SDL_events.c:336:53: warning: format '%d' expects argument of type 'int', but argument 5 has type 'long long int' [-Wformat=]
  336 |             SDL_snprintf(details, sizeof (details), " (timestamp=%u touchid=%"SDL_PRIs64" fingerid=%"SDL_PRIs64" x=%f y=%f dx=%f dy=%f pressure=%f)", \
      |                                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~
  337 |                 (uint) event->tfinger.timestamp, (long long)event->tfinger.touchId, \
      |                                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                  |
      |                                                  long long int
/cygdrive/e/fly-prj/SDL2/SDL2-2.0.16/src/events/SDL_events.c:342:42: note: in expansion of macro 'PRINT_FINGER_EVENT'
  342 |         SDL_EVENT_CASE(SDL_FINGERMOTION) PRINT_FINGER_EVENT(event); break;
      |                                          ^~~~~~~~~~~~~~~~~~
/cygdrive/e/fly-prj/SDL2/SDL2-2.0.16/src/events/SDL_events.c:38:25: note: format string is defined here
   38 | #define SDL_PRIs64  "I64d"
      |                         ^
      |                         |
      |                         int
/cygdrive/e/fly-prj/SDL2/SDL2-2.0.16/src/events/SDL_events.c:336:53: warning: format '%d' expects argument of type 'int', but argument 6 has type 'long long int' [-Wformat=]
  336 |             SDL_snprintf(details, sizeof (details), " (timestamp=%u touchid=%"SDL_PRIs64" fingerid=%"SDL_PRIs64" x=%f y=%f dx=%f dy=%f pressure=%f)", \
      |                                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~
  337 |                 (uint) event->tfinger.timestamp, (long long)event->tfinger.touchId, \
  338 |                 (long long)event->tfinger.fingerId, event->tfinger.x, event->tfinger.y, \
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                 |
      |                 long long int
/cygdrive/e/fly-prj/SDL2/SDL2-2.0.16/src/events/SDL_events.c:342:42: note: in expansion of macro 'PRINT_FINGER_EVENT'
  342 |         SDL_EVENT_CASE(SDL_FINGERMOTION) PRINT_FINGER_EVENT(event); break;
      |                                          ^~~~~~~~~~~~~~~~~~
/cygdrive/e/fly-prj/SDL2/SDL2-2.0.16/src/events/SDL_events.c:38:25: note: format string is defined here
   38 | #define SDL_PRIs64  "I64d"
      |                         ^
      |                         |
      |                         int
/cygdrive/e/fly-prj/SDL2/SDL2-2.0.16/src/events/SDL_events.c:346:53: warning: format '%d' expects argument of type 'int', but argument 5 has type 'long long int' [-Wformat=]
  346 |             SDL_snprintf(details, sizeof (details), " (timestamp=%u touchid=%"SDL_PRIs64" gestureid=%"SDL_PRIs64" numfingers=%u error=%f x=%f y=%f)", \
      |                                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~
  347 |                 (uint) event->dgesture.timestamp, (long long)event->dgesture.touchId, \
      |                                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                   |
      |                                                   long long int
/cygdrive/e/fly-prj/SDL2/SDL2-2.0.16/src/events/SDL_events.c:350:43: note: in expansion of macro 'PRINT_DOLLAR_EVENT'
  350 |         SDL_EVENT_CASE(SDL_DOLLARGESTURE) PRINT_DOLLAR_EVENT(event); break;
      |                                           ^~~~~~~~~~~~~~~~~~
/cygdrive/e/fly-prj/SDL2/SDL2-2.0.16/src/events/SDL_events.c:38:25: note: format string is defined here
   38 | #define SDL_PRIs64  "I64d"
      |                         ^
      |                         |
      |                         int
/cygdrive/e/fly-prj/SDL2/SDL2-2.0.16/src/events/SDL_events.c:346:53: warning: format '%d' expects argument of type 'int', but argument 6 has type 'long long int' [-Wformat=]
  346 |             SDL_snprintf(details, sizeof (details), " (timestamp=%u touchid=%"SDL_PRIs64" gestureid=%"SDL_PRIs64" numfingers=%u error=%f x=%f y=%f)", \
      |                                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~
  347 |                 (uint) event->dgesture.timestamp, (long long)event->dgesture.touchId, \
  348 |                 (long long)event->dgesture.gestureId, (uint) event->dgesture.numFingers, \
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                 |
      |                 long long int
/cygdrive/e/fly-prj/SDL2/SDL2-2.0.16/src/events/SDL_events.c:350:43: note: in expansion of macro 'PRINT_DOLLAR_EVENT'
  350 |         SDL_EVENT_CASE(SDL_DOLLARGESTURE) PRINT_DOLLAR_EVENT(event); break;
      |                                           ^~~~~~~~~~~~~~~~~~
/cygdrive/e/fly-prj/SDL2/SDL2-2.0.16/src/events/SDL_events.c:38:25: note: format string is defined here
   38 | #define SDL_PRIs64  "I64d"
      |                         ^
      |                         |
      |                         int
/cygdrive/e/fly-prj/SDL2/SDL2-2.0.16/src/events/SDL_events.c:346:53: warning: format '%d' expects argument of type 'int', but argument 5 has type 'long long int' [-Wformat=]
  346 |             SDL_snprintf(details, sizeof (details), " (timestamp=%u touchid=%"SDL_PRIs64" gestureid=%"SDL_PRIs64" numfingers=%u error=%f x=%f y=%f)", \
      |                                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~
  347 |                 (uint) event->dgesture.timestamp, (long long)event->dgesture.touchId, \
      |                                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                   |
      |                                                   long long int
/cygdrive/e/fly-prj/SDL2/SDL2-2.0.16/src/events/SDL_events.c:351:42: note: in expansion of macro 'PRINT_DOLLAR_EVENT'
  351 |         SDL_EVENT_CASE(SDL_DOLLARRECORD) PRINT_DOLLAR_EVENT(event); break;
      |                                          ^~~~~~~~~~~~~~~~~~
/cygdrive/e/fly-prj/SDL2/SDL2-2.0.16/src/events/SDL_events.c:38:25: note: format string is defined here
   38 | #define SDL_PRIs64  "I64d"
      |                         ^
      |                         |
      |                         int
/cygdrive/e/fly-prj/SDL2/SDL2-2.0.16/src/events/SDL_events.c:346:53: warning: format '%d' expects argument of type 'int', but argument 6 has type 'long long int' [-Wformat=]
  346 |             SDL_snprintf(details, sizeof (details), " (timestamp=%u touchid=%"SDL_PRIs64" gestureid=%"SDL_PRIs64" numfingers=%u error=%f x=%f y=%f)", \
      |                                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~
  347 |                 (uint) event->dgesture.timestamp, (long long)event->dgesture.touchId, \
  348 |                 (long long)event->dgesture.gestureId, (uint) event->dgesture.numFingers, \
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                 |
      |                 long long int
/cygdrive/e/fly-prj/SDL2/SDL2-2.0.16/src/events/SDL_events.c:351:42: note: in expansion of macro 'PRINT_DOLLAR_EVENT'
  351 |         SDL_EVENT_CASE(SDL_DOLLARRECORD) PRINT_DOLLAR_EVENT(event); break;
      |                                          ^~~~~~~~~~~~~~~~~~
/cygdrive/e/fly-prj/SDL2/SDL2-2.0.16/src/events/SDL_events.c:38:25: note: format string is defined here
   38 | #define SDL_PRIs64  "I64d"
      |                         ^
      |                         |
      |                         int
/cygdrive/e/fly-prj/SDL2/SDL2-2.0.16/src/events/SDL_events.c:355:53: warning: format '%d' expects argument of type 'int', but argument 5 has type 'long long int' [-Wformat=]
  355 |             SDL_snprintf(details, sizeof (details), " (timestamp=%u touchid=%"SDL_PRIs64" dtheta=%f ddist=%f x=%f y=%f numfingers=%u)",
      |                                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~
  356 |                 (uint) event->mgesture.timestamp, (long long)event->mgesture.touchId,
      |                                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                   |
      |                                                   long long int
/cygdrive/e/fly-prj/SDL2/SDL2-2.0.16/src/events/SDL_events.c:38:25: note: format string is defined here
   38 | #define SDL_PRIs64  "I64d"
      |                         ^
      |                         |
      |                         int
  CC     build/SDL_gesture.lo
  CC     build/SDL_keyboard.lo
  CC     build/SDL_mouse.lo
  CC     build/SDL_quit.lo
  CC     build/SDL_touch.lo
  CC     build/SDL_windowevents.lo
  CC     build/SDL_rwops.lo
  CC     build/SDL_haptic.lo
  CC     build/SDL_gamecontroller.lo
  CC     build/SDL_joystick.lo
  CC     build/e_atan2.lo
  CC     build/e_exp.lo
  CC     build/e_fmod.lo
  CC     build/e_log.lo
  CC     build/e_log10.lo
  CC     build/e_pow.lo
  CC     build/e_rem_pio2.lo
  CC     build/e_sqrt.lo
  CC     build/k_cos.lo
  CC     build/k_rem_pio2.lo
  CC     build/k_sin.lo
  CC     build/k_tan.lo
  CC     build/s_atan.lo
  CC     build/s_copysign.lo
  CC     build/s_cos.lo
  CC     build/s_fabs.lo
  CC     build/s_floor.lo
  CC     build/s_scalbn.lo
  CC     build/s_sin.lo
  CC     build/s_tan.lo
  CC     build/SDL_url.lo
  CC     build/SDL_power.lo
  CC     build/SDL_d3dmath.lo
  CC     build/SDL_render.lo
  CC     build/SDL_yuv_sw.lo
  CC     build/SDL_render_d3d.lo
  CC     build/SDL_shaders_d3d.lo
  CC     build/SDL_render_d3d11.lo
  CC     build/SDL_shaders_d3d11.lo
  CC     build/SDL_render_gl.lo
  CC     build/SDL_shaders_gl.lo
  CC     build/SDL_render_gles.lo
  CC     build/SDL_render_gles2.lo
  CC     build/SDL_shaders_gles2.lo
  CC     build/SDL_render_psp.lo
  CC     build/SDL_blendfillrect.lo
  CC     build/SDL_blendline.lo
  CC     build/SDL_blendpoint.lo
  CC     build/SDL_drawline.lo
  CC     build/SDL_drawpoint.lo
  CC     build/SDL_render_sw.lo
  CC     build/SDL_rotate.lo
  CC     build/SDL_render_vita_gxm.lo
  CC     build/SDL_render_vita_gxm_memory.lo
  CC     build/SDL_render_vita_gxm_tools.lo
  CC     build/SDL_sensor.lo
  CC     build/SDL_crc32.lo
  CC     build/SDL_getenv.lo
  CC     build/SDL_iconv.lo
  CC     build/SDL_malloc.lo
  CC     build/SDL_qsort.lo
  CC     build/SDL_stdlib.lo
  CC     build/SDL_string.lo
  CC     build/SDL_strtokr.lo
  CC     build/SDL_thread.lo
  CC     build/SDL_timer.lo
  CC     build/SDL_RLEaccel.lo
  CC     build/SDL_blit.lo
  CC     build/SDL_blit_0.lo
  CC     build/SDL_blit_1.lo
  CC     build/SDL_blit_A.lo
  CC     build/SDL_blit_N.lo
  CC     build/SDL_blit_auto.lo
  CC     build/SDL_blit_copy.lo
  CC     build/SDL_blit_slow.lo
  CC     build/SDL_bmp.lo
  CC     build/SDL_clipboard.lo
  CC     build/SDL_egl.lo
  CC     build/SDL_fillrect.lo
  CC     build/SDL_pixels.lo
  CC     build/SDL_rect.lo
  CC     build/SDL_shape.lo
  CC     build/SDL_stretch.lo
  CC     build/SDL_surface.lo
  CC     build/SDL_video.lo
  CC     build/SDL_vulkan_utils.lo
  CC     build/SDL_yuv.lo
  CC     build/yuv_rgb.lo
  CC     build/SDL_locale.lo
  CC     build/SDL_nullevents.lo
  CC     build/SDL_nullframebuffer.lo
  CC     build/SDL_nullvideo.lo
  CC     build/SDL_diskaudio.lo
  CC     build/SDL_dummyaudio.lo
  CC     build/SDL_hidapi_gamecube.lo
  CC     build/SDL_hidapi_luna.lo
  CC     build/SDL_hidapi_ps4.lo
  CC     build/SDL_hidapi_ps5.lo
  CC     build/SDL_hidapi_rumble.lo
  CC     build/SDL_hidapi_stadia.lo
  CC     build/SDL_hidapi_steam.lo
  CC     build/SDL_hidapi_switch.lo
  CC     build/SDL_hidapi_xbox360.lo
  CC     build/SDL_hidapi_xbox360w.lo
  CC     build/SDL_hidapi_xboxone.lo
  CC     build/SDL_hidapijoystick.lo
  CC     build/SDL_hidapi.lo
  CC     build/SDL_hid.lo
  CC     build/SDL_windows.lo
  CC     build/SDL_xinput.lo
  CC     build/SDL_sysurl.lo
  CC     build/SDL_syslocale.lo
  CC     build/SDL_windowsclipboard.lo
  CC     build/SDL_windowsevents.lo
  CC     build/SDL_windowsframebuffer.lo
  CC     build/SDL_windowskeyboard.lo
  CC     build/SDL_windowsmessagebox.lo
  CC     build/SDL_windowsmodes.lo
  CC     build/SDL_windowsmouse.lo
  CC     build/SDL_windowsopengl.lo
  CC     build/SDL_windowsopengles.lo
  CC     build/SDL_windowsshape.lo
  CC     build/SDL_windowsvideo.lo
  CC     build/SDL_windowsvulkan.lo
  CC     build/SDL_windowswindow.lo
  CC     build/SDL_winmm.lo
  CC     build/SDL_wasapi.lo
  CC     build/SDL_wasapi_win32.lo
  CC     build/SDL_dinputjoystick.lo
  CC     build/SDL_mmjoystick.lo
  CC     build/SDL_rawinputjoystick.lo
  CC     build/SDL_windows_gaming_input.lo
  CC     build/SDL_windowsjoystick.lo
  CC     build/SDL_xinputjoystick.lo
  CC     build/SDL_dinputhaptic.lo
  CC     build/SDL_windowshaptic.lo
  CC     build/SDL_xinputhaptic.lo
  CC     build/SDL_windowssensor.lo
  CC     build/SDL_syspower.lo
  CC     build/SDL_sysfilesystem.lo
  CC     build/SDL_syscond_srw.lo
  CC     build/SDL_sysmutex.lo
  CC     build/SDL_syssem.lo
  CC     build/SDL_systhread.lo
  CC     build/SDL_systls.lo
  CC     build/SDL_syscond.lo
  CC     build/SDL_systimer.lo
  CC     build/SDL_sysloadso.lo
  CC     build/SDL_virtualjoystick.lo
  RC     build/version.lo
  LTLINK build/libSDL2.la

*** Warning: Linking the shared library build/libSDL2.la against the
*** static library /lib/w32api/libuuid.a is not portable!
<输出文件>
管道正在被关闭。
copying selected object files to avoid basename conflicts...
  CC     build/SDL_windows_main.lo
  LTLINK build/libSDL2main.la
<输出文件>
管道正在被关闭。
copying selected object files to avoid basename conflicts...
  CC     build/SDL_test_assert.lo
  CC     build/SDL_test_common.lo
  CC     build/SDL_test_compare.lo
  CC     build/SDL_test_crc32.lo
  CC     build/SDL_test_font.lo
  CC     build/SDL_test_fuzzer.lo
  CC     build/SDL_test_harness.lo
  CC     build/SDL_test_imageBlit.lo
  CC     build/SDL_test_imageBlitBlend.lo
  CC     build/SDL_test_imageFace.lo
  CC     build/SDL_test_imagePrimitives.lo
  CC     build/SDL_test_imagePrimitivesBlend.lo
  CC     build/SDL_test_log.lo
  CC     build/SDL_test_md5.lo
  CC     build/SDL_test_memory.lo
  CC     build/SDL_test_random.lo
  LTLINK build/libSDL2_test.la
<输出文件>
管道正在被关闭。
copying selected object files to avoid basename conflicts...

lanfeiy@yelanfei /cygdrive/e/fly-prj/SDL2/SDL2-2.0.16

安装:

lanfeiy@yelanfei /cygdrive/e/fly-prj/SDL2/SDL2-2.0.16
$ make install
/bin/sh build-scripts/updaterev.sh
/bin/sh build-scripts/mkinstalldirs /usr/local/bin
/usr/bin/install -c -m 755 sdl2-config /usr/local/bin/sdl2-config
/bin/sh build-scripts/mkinstalldirs /usr/local/include/SDL2
mkdir -p -- /usr/local/include/SDL2
for file in SDL.h SDL_assert.h SDL_atomic.h SDL_audio.h SDL_bits.h SDL_blendmode.h SDL_clipboard.h SDL_cpuinfo.h SDL_egl.h SDL_endian.h SDL_error.h SDL_events.h SDL_filesystem.h SDL_gamecontroller.h SDL_gesture.h SDL_haptic.h SDL_hints.h SDL_joystick.h SDL_keyboard.h SDL_keycode.h SDL_loadso.h SDL_locale.h SDL_log.h SDL_main.h SDL_messagebox.h SDL_metal.h SDL_misc.h SDL_mouse.h SDL_mutex.h SDL_name.h SDL_opengl.h SDL_opengl_glext.h SDL_opengles.h SDL_opengles2_gl2ext.h SDL_opengles2_gl2.h SDL_opengles2_gl2platform.h SDL_opengles2.h SDL_opengles2_khrplatform.h SDL_pixels.h SDL_platform.h SDL_power.h SDL_quit.h SDL_rect.h SDL_render.h SDL_rwops.h SDL_scancode.h SDL_sensor.h SDL_shape.h SDL_stdinc.h SDL_surface.h SDL_system.h SDL_syswm.h SDL_thread.h SDL_timer.h SDL_touch.h SDL_types.h SDL_version.h SDL_video.h SDL_vulkan.h begin_code.h close_code.h SDL_test.h SDL_test_assert.h SDL_test_common.h SDL_test_compare.h SDL_test_crc32.h SDL_test_font.h SDL_test_fuzzer.h SDL_test_harness.h SDL_test_images.h SDL_test_log.h SDL_test_md5.h SDL_test_memory.h SDL_test_random.h; do \
    /usr/bin/install -c -m 644 /cygdrive/e/fly-prj/SDL2/SDL2-2.0.16/include/$file /usr/local/include/SDL2/$file; \
done
/usr/bin/install -c -m 644 include/SDL_config.h /usr/local/include/SDL2/SDL_config.h
if test -f include/SDL_revision.h; then \
    /usr/bin/install -c -m 644 include/SDL_revision.h /usr/local/include/SDL2/SDL_revision.h; \
else \
    /usr/bin/install -c -m 644 /cygdrive/e/fly-prj/SDL2/SDL2-2.0.16/include/SDL_revision.h /usr/local/include/SDL2/SDL_revision.h; \
fi
/bin/sh build-scripts/mkinstalldirs /usr/local/lib
/bin/sh ./libtool --quiet --mode=install /usr/bin/install -c build/libSDL2.la /usr/local/lib/libSDL2.la
/bin/sh ./libtool --quiet --mode=install /usr/bin/install -c build/libSDL2main.la /usr/local/lib/libSDL2main.la
/bin/sh ./libtool --quiet --mode=install /usr/bin/install -c build/libSDL2_test.la /usr/local/lib/libSDL2_test.la
/bin/sh build-scripts/mkinstalldirs /usr/local/share/aclocal
mkdir -p -- /usr/local/share/aclocal
/usr/bin/install -c -m 644 /cygdrive/e/fly-prj/SDL2/SDL2-2.0.16/sdl2.m4 /usr/local/share/aclocal/sdl2.m4
/bin/sh build-scripts/mkinstalldirs /usr/local/lib/pkgconfig
mkdir -p -- /usr/local/lib/pkgconfig
/usr/bin/install -c -m 644 sdl2.pc /usr/local/lib/pkgconfig
/bin/sh build-scripts/mkinstalldirs /usr/local/lib/cmake/SDL2
mkdir -p -- /usr/local/lib/cmake/SDL2
/usr/bin/install -c -m 644 sdl2-config.cmake /usr/local/lib/cmake/SDL2
/usr/bin/install -c -m 644 sdl2-config-version.cmake /usr/local/lib/cmake/SDL2

lanfeiy@yelanfei /cygdrive/e/fly-prj/SDL2/SDL2-2.0.16
$

3.测试

实例1
/*******************************************************************
 *   > File Name: main.cpp
 *   > Create Time: 2021年09月15日 11:16:26
 ******************************************************************/
#include <iostream>
#include <SDL.h>
using namespace std;

//int main(void)
//int main(int, char**)
int main(int argc, char* argv[])
{
    if (SDL_Init(SDL_INIT_VIDEO) != 0){
		std::cout << "SDL_Init Error: " << SDL_GetError() << std::endl;
		return 1;
	}
	SDL_Quit();
    return 0;
}
Makefile文件
CXX = g++
SDL_LIB	= -LD:/softwareTools/DesTools/Cygwin64/usr/local/lib -lSDL2main -lSDL2
SDL_INCLUDE = -ID:/softwareTools/DesTools/Cygwin64/usr/local/include/SDL2
CXXFLAGS = -Wall -c -std=c++11 $(SDL_INCLUDE)
#LDFLAGS = -lmingw32 -mwindows -mconsole $(SDL_LIB)
LDFLAGS = -lcygwin -mwindows -mconsole $(SDL_LIB)
EXE = SDL_Lesson0.exe

all: $(EXE)

$(EXE): main.o
	$(CXX) $< $(LDFLAGS) -o $@

main.o: main.cpp
	$(CXX) $(CXXFLAGS) $< -o $@

clean:
	del *.o && del $(EXE)

编译、运行

PS E:\fly-prj\cplusplus\day13\SDL2> make 
g++ -Wall -c -std=c++11 -ID:/softwareTools/DesTools/Cygwin64/usr/local/include/SDL2 main.cpp -o main.o
g++ main.o -lcygwin -mwindows -mconsole -LD:/softwareTools/DesTools/Cygwin64/usr/local/lib -lSDL2main -lSDL2 -o SDL_Lesson0.exe
PS E:\fly-prj\cplusplus\day13\SDL2> .\SDL_Lesson0.exe

笔记:

编译测试代码报错1:

PS E:\fly-prj\cplusplus\day13\SDL2> make 
g++ -Wall -c -std=c++11 -ID:/softwareTools/DesTools/Cygwin64/usr/local/include/SDL2 main.cpp -o main.o
g++ main.o -lcygwin -mwindows -mconsole -LD:/softwareTools/DesTools/Cygwin64/usr/local/lib -lSDL2main -lSDL2 -o SDL_Lesson0.exe
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: D:/softwareTools/DesTools/Cygwin64/usr/local/lib/libSDL2main.a(SDL_windows_main.o): in function `main_getcmdline':
/cygdrive/e/fly-prj/SDL2/SDL2-2.0.16/src/main/windows/SDL_windows_main.c:82: undefined reference to `SDL_main'
collect2: 错误:ld 返回 1
make: *** [Makefile:12:SDL_Lesson0.exe] 错误 1

修改如下:

# 在测试代码中修改如下部分:
//int main(void)
int main(int, char**)

后记:测试未通过,待后续研究

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值