[FFmpeg-devel] [PATCH] Make compilable with VS2015

Peter dravorek at googlemail.com
Fri Mar 6 20:42:20 CET 2015


>From c72344d2b1dc8b087e5da904724c959005f36f4b Mon Sep 17 00:00:00 2001
From: Peter Tissen <dravorek at gmail.com>
Date: Fri, 6 Mar 2015 19:39:27 +0100
Subject: [PATCH] Make compilable with VS2015

So Visual Studio 2015 has some breaking changes regarding the C
runtime. In short, they made C99 compatable runtime.
Refer to http://blogs.msdn.com/b/vcblog/archive/2014/06/18/crt-features-fixes-and-breaking-changes-in-visual-studio-14-ctp1.aspx

Signed-off-by: Peter Tissen <dravorek at gmail.com>
---
 configure            | 14 +++++++++-----
 libavutil/internal.h |  2 +-
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/configure b/configure
index ce745d2..1ea2032 100755
--- a/configure
+++ b/configure
@@ -3531,7 +3531,9 @@ probe_cc(){
         _flags='-nologo'
         _cflags='-D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS
-Dinline=__inline -FIstdlib.h -Dstrtoll=_strtoi64'
         if [ $pfx = hostcc ]; then
-            append _cflags -Dsnprintf=_snprintf
+            if [ -z "$cl_major_ver" ] || [ $cl_major_ver -le 18 ]; then
+                append _cflags -Dsnprintf=_snprintf
+            fi
         fi
         disable stripping
     elif $_cc --version 2>/dev/null | grep -q ^cparser; then
@@ -4318,10 +4320,12 @@ case $libc_type in
         add_compat strtod.o strtod=avpriv_strtod
         ;;
     msvcrt)
-        add_compat strtod.o strtod=avpriv_strtod
-        add_compat msvcrt/snprintf.o snprintf=avpriv_snprintf   \
-                                     _snprintf=avpriv_snprintf  \
-                                     vsnprintf=avpriv_vsnprintf
+        if [ -z "$cl_major_ver" ] || [ $cl_major_ver -le 18 ]; then
+            add_compat strtod.o strtod=avpriv_strtod
+            add_compat msvcrt/snprintf.o snprintf=avpriv_snprintf   \
+                                         _snprintf=avpriv_snprintf  \
+                                         vsnprintf=avpriv_vsnprintf
+        fi
         ;;
 esac

diff --git a/libavutil/internal.h b/libavutil/internal.h
index 143e2db..08ee6e5 100644
--- a/libavutil/internal.h
+++ b/libavutil/internal.h
@@ -164,7 +164,7 @@

 #include "libm.h"

-#if defined(_MSC_VER)
+#if defined(_MSC_VER) && _MSC_VER < 1900
 #pragma comment(linker, "/include:"EXTERN_PREFIX"avpriv_strtod")
 #pragma comment(linker, "/include:"EXTERN_PREFIX"avpriv_snprintf")
 #endif
-- 
1.9.4.msysgit.1


More information about the ffmpeg-devel mailing list