VS 2015编译cocos2d-x3.6错误snprintf的宏定义与标准库函数声明冲突
VS 2015 compiling cocos2d-x 3.6 error Macro definition of snprintf conflicts with Standard Library function declaration
我用visual studio 2015编译cocos2d-x(3.6版),出现错误,说:
fatal error C1189: #error: Macro definition of snprintf conflicts with Standard Library function declaration
和这个问题差不多link
here
我试着按照第一个答案,然后在 cocos 论坛上搜索大部分结果,但也失败了,我是菜鸟,现在真的不知道..
这是我的源代码,在头文件 stdio.h
上定义了 snprintf
#if defined snprintf
// This definition of snprintf will generate "warning C4005: 'snprintf': macro
// redefinition" with a subsequent line indicating where the previous definition
// of snprintf was. This makes it easier to find where snprintf was defined.
#pragma warning(push, 1)
#pragma warning(1: 4005)
#define snprintf Do not define snprintf as a macro
#pragma warning(pop)
#error Macro definition of snprintf conflicts with Standard Library function declaration
#endif
有人可以帮助我..谢谢!
我在尝试构建 libsndfile-1 时遇到同样的错误。我通过使用 VS2013 而不是 VS2015 进行构建来解决它。 (我认为应该可以简单地安装 VS2013 构建工具并从 VS2015 构建)。
编辑:安装 VS2013 构建工具集,运行 VS2015 安装程序和 select 'Windows 8.1 and Windows Phone 8.0/8.1 Tools'
我用visual studio 2015编译cocos2d-x(3.6版),出现错误,说:
fatal error C1189: #error: Macro definition of snprintf conflicts with Standard Library function declaration
和这个问题差不多link here
我试着按照第一个答案,然后在 cocos 论坛上搜索大部分结果,但也失败了,我是菜鸟,现在真的不知道..
这是我的源代码,在头文件 stdio.h
snprintf
#if defined snprintf
// This definition of snprintf will generate "warning C4005: 'snprintf': macro
// redefinition" with a subsequent line indicating where the previous definition
// of snprintf was. This makes it easier to find where snprintf was defined.
#pragma warning(push, 1)
#pragma warning(1: 4005)
#define snprintf Do not define snprintf as a macro
#pragma warning(pop)
#error Macro definition of snprintf conflicts with Standard Library function declaration
#endif
有人可以帮助我..谢谢!
我在尝试构建 libsndfile-1 时遇到同样的错误。我通过使用 VS2013 而不是 VS2015 进行构建来解决它。 (我认为应该可以简单地安装 VS2013 构建工具并从 VS2015 构建)。
编辑:安装 VS2013 构建工具集,运行 VS2015 安装程序和 select 'Windows 8.1 and Windows Phone 8.0/8.1 Tools'