【问题标题】:The error notes that Macro definition of snprintf conflicts with Standard Library function declaration when debug the LZO错误提示在调试 LZO 时 snprintf 的宏定义与标准库函数声明冲突
【发布时间】:2018-03-17 14:15:29
【问题描述】:

我已经通过cmake编译了lzo的原始代码,并尝试调试VS项目lzo.sin,但是VS的提示指出

#error:  Macro definition of snprintf conflicts with Standard Library function declaration,

enter image description here

然后我发现有人说是因为VS2015定义了snprintf,项目中的代码也定义了它,因此出现错误。我将lzo_supp.h文件中的代码#define snprintf _snprintf替换为

#  ifndef
#    define snprintf _snprintf
#  endif

但错误仍然存​​在。我不知道如何解决。

【问题讨论】:

    标签: visual-studio-2015 lzo


    【解决方案1】:

    我用过

    #if _MSC_VER < 1900 
    #define snprintf _snprintf
    #endif
    

    仍在学习 c++,几周前开始,所以我不知道这是如何解决它的,除此之外只需要在 2015 年以下的 VS 版本上定义它。这是我找到答案的地方 https://forum.juce.com/t/solved-error-with-vs2015-regarding-snprintf/14831/3

    【讨论】:

    • 这样做会引发链接器问题。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-05-16
    • 2012-05-09
    • 1970-01-01
    • 1970-01-01
    • 2018-11-07
    • 2018-10-27
    • 2011-06-27
    相关资源
    最近更新 更多