【问题标题】:moved from cygwin to VisualStudio2013, error LNK2019, snprintf(), c从 cygwin 移动到 VisualStudio2013,错误 LNK2019,snprintf(),c
【发布时间】:2015-04-19 00:43:31
【问题描述】:

我正在尝试使用 MS Visual-Studio 2013 运行用 c 编写的 unix 编译器项目,但无法摆脱以下错误:

error LNK2019: unresolved external symbol "_snprintf" referenced in 
    function "PUBLIC void SyntaxError( int Expected, TOKEN CurrentToken )"

如果我做对了,那是 VisualStudio 无法从 snprintf() 函数中找到正文/声明的问题,该函数应在 stdio.h 中定义。

该项目在 cygwin 下运行良好。我必须在预处理器设置中添加_CRT_SECURE_NO_WARNINGS 才能达到这一点,但我认为这没有影响。

这是命名函数:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "line.h"
#include "strtab.h"
#include "scanner.h"

[..code..]


PUBLIC void   SyntaxError( int Expected, TOKEN CurrentToken )
{
    char s[M_LINE_WIDTH+2];

    snprintf( s, sizeof(s), "Syntax: Expected %s, got %s\n", Tokens[Expected], Tokens[CurrentToken.code] );
    Error( s, CurrentToken.pos );
}

如果你能帮助我或者还有什么需要知道的,请告诉我。现在是我的第三天,我的想法已经不多了;)。

到目前为止...托拜厄斯

【问题讨论】:

    标签: c visual-studio-2013 cygwin linker-errors stdio


    【解决方案1】:

    使用 MSVC 编译器的这个函数的名称是 _snprintf(),带有下划线。

    【讨论】:

    • 天哪,我的错。我不记得有第二个功能。有效。太感谢了!!!你拯救了我的一天!
    猜你喜欢
    • 1970-01-01
    • 2017-04-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-01-04
    • 1970-01-01
    • 2015-10-14
    • 1970-01-01
    相关资源
    最近更新 更多