Error:LNK2019无法解析的外部符号_sscanf, _vsprintf

IDE:Visual Stdio 2015
System:Windows 10

在练习OpenGL时,编译出现了如下错误:

原因在OpenGL的glaux辅助库中,用到了_sscanf和_vsprintf。而VS 2015默认编译时将许多标准库都以inline方式处理,因而没有可以链接的标准库文件,所以要添加专门的标准库文件来链接标准库中的函数。

加入如下代码解决:

#pragma comment(lib, "legacy_stdio_definitions.lib")

猜你喜欢

转载自www.cnblogs.com/coolcpp/p/LNK2019.html