Skip to content

Building with VS2015 #42

Description

@Jedzia

Don't believe it but finally, Visual Studio 14 defines snprintf()!
It restricts redefinition, this is added in stdio.h:

#ifdef snprintf
    #error: Macro definition of snprintf conflicts with Standard Library function declaration”
#endif

so we get
...\ucrt\stdio.h(1927): fatal error C1189: #error: Macro definition of snprintf conflicts with Standard Library function declaration [...\lua-cjson\build\cjson.vcxproj errors.

My solution to this was skipping of add_definitions(-Dstrncasecmp=_strnicmp) for MSVC14. Patch follows:

CMakeLists.txt | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index ca26381..ff74d6f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -71,8 +71,10 @@ endif()
 if(MSVC)
     add_definitions(-D_CRT_SECURE_NO_WARNINGS)
     add_definitions(-Dinline=__inline)
-    add_definitions(-Dsnprintf=_snprintf)
-    add_definitions(-Dstrncasecmp=_strnicmp)
+   if(NOT MSVC14)
+       add_definitions(-Dsnprintf=_snprintf)
+   endif(NOT MSVC14)
+   add_definitions(-Dstrncasecmp=_strnicmp)
 endif()

 add_library(cjson MODULE lua_cjson.c strbuf.c ${FPCONV_SOURCES})

Keep on coding, Jedzia;)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions