Visual Studio使用链接器LNK2019获取两个未解析的外部

Visual Studio takes two unresolved externals with the linkers LNK2019

本文关键字:两个 外部 Studio 链接 获取 LNK2019 Visual      更新时间:2023-10-16

我的代码是这样的

#include <iostream>
#include <SDL2SDL.h>
int main(int argc, char* args[])
{
    char tep;
    std::cin >> tep;
    return 0;
}

Visual Studio现在显示以下错误:

LNK1120 2 unresolved externals
LNK2019 reference to unresolved external symbol "_imp_ printf" function in "_ShowError".
LNK2019 reference to unresolved external symbol "_imp_ _iob_func" in function "_ShowError".

我真的已经搜索了很多关于这个问题的文章,但要么是它说的是真的不仅仅是我的问题,要么是解决方案不起作用。

如果有帮助的话,我一直在制作以下视频:https://www.youtube.com/watch?v=uzwAYyK9ZBY&feature=iv&src_vid=TC0kHYRWX1Y&annotation_id=annotation_1897517141

Thanks in advance

尝试在入口点之前放置#undef。我就遇到过这样的问题。试试吧,然后告诉我效果如何。

由于某种原因SDL定义了"#define main SDL_main"

那么试试这样写:

#undef

int main(int arc, char *args[])