[PATCH 3/4] include: Windows SDK C headers have snprintf.

Stefan Dösinger stefan at codeweavers.com
Sun Nov 17 06:43:14 CST 2019

And it is a function prototype, so we can't use #ifndef.

Signed-off-by: Stefan Dösinger <stefan at codeweavers.com>


I am also open to just removing the define. It was added in 817fb975.
 include/wine/port.h | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/include/wine/port.h b/include/wine/port.h
index b3ef4b905a9..264f2828373 100644
--- a/include/wine/port.h
+++ b/include/wine/port.h
@@ -69,7 +69,13 @@
 #define popen _popen
 #define pclose _pclose
-#define snprintf _snprintf
+/* The UCRT headers in the Windows SDK #error out if we #define snprintf.
+ * The C headers that came with previous Visual Studio versions do not have
+ * snprintf. Check for VS 2015, which appears to be the first version to
+ * use the UCRT headers by default. */
+#if _MSC_VER < 1900
+# define snprintf _snprintf
 #define strtoll _strtoi64
 #define strtoull _strtoui64
 #define strncasecmp _strnicmp

More information about the wine-devel mailing list