未解析的外部符号__imp__fprintf和__imp____iob_func,SDL2 [英] unresolved external symbol __imp__fprintf and __imp____iob_func, SDL2

查看:3327
本文介绍了未解析的外部符号__imp__fprintf和__imp____iob_func,SDL2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以解释什么


__ imp__fprintf



__ imp ____ iob_func


未解决的外部手段?



因为我在尝试编译时遇到这些错误:

  1> SDL2main.lib(SDL_windows_main.obj):error LNK2019:未解析的外部符号__imp__fprintf在函数_ShowError中引用
1> SDL2main.lib(SDL_windows_main.obj):error LNK2019:未解析的外部符号__imp____iob_func在函数_ShowError中引用
1> E:\Documents\Visual Studio 2015 \Projects\SDL2_Test\Debug\SDL2_Test.exe:致命错误LNK1120:2未解析的外部

我可以说这个问题不是从链接错误。



我试图使用SDL2。



我使用Visual Studio 2015作为编译器。



我已链接到SDL2.lib和SDL2main.lib在链接 - >输入 - >附加依赖我已经确定VC ++目录是正确的。

解决方案

>

在visual studio 2015中,stdin,stderr,stdout定义如下:

  #define stdin(__acrt_iob_func(0))
#define stdout(__acrt_iob_func(1))
#define stderr(__acrt_iob_func(2))

但以前,它们被定义为:

  #define stdin (& __ iob_func()[0])
#define stdout(& __ iob_func()[1])$ ​​b $ b #define stderr(& __ iob_func()[2])

所以现在没有定义__iob_func,导致在使用以前版本的visual studio编译的.lib文件时出现链接错误。



为了解决这个问题,你可以尝试定义 __ iob_func() $ c> {* stdin,* stdout,* stderr}



关于stdio函数的其他链接错误 sprintf()),您可以向链接器选项中添加 legacy_stdio_definitions.lib


Could someone explain what the

__imp__fprintf

and

__imp____iob_func

unresolved external means?

Because I get these errors when I'm trying to compile:

1>SDL2main.lib(SDL_windows_main.obj) : error LNK2019: unresolved external symbol __imp__fprintf referenced in function _ShowError
1>SDL2main.lib(SDL_windows_main.obj) : error LNK2019: unresolved external symbol __imp____iob_func referenced in function _ShowError
1>E:\Documents\Visual Studio 2015\Projects\SDL2_Test\Debug\SDL2_Test.exe : fatal error LNK1120: 2 unresolved externals

I can already say that the problem is not from linking wrong. I have linked everything up correctly, but for some reason it won't compile.

I'm trying to use SDL2.

I'm using Visual Studio 2015 as compiler.

I have linked to SDL2.lib and SDL2main.lib in Linker -> Input -> Additional Dependencies and I have made sure that the VC++ Directories are correct.

解决方案

I have finally figured out why this is happening !

In visual studio 2015, stdin, stderr, stdout are defined as follow :

#define stdin  (__acrt_iob_func(0))
#define stdout (__acrt_iob_func(1))
#define stderr (__acrt_iob_func(2))

But previously, they were defined as:

#define stdin  (&__iob_func()[0])
#define stdout (&__iob_func()[1])
#define stderr (&__iob_func()[2])

So now __iob_func is not defined anymore which leads to a link error when using a .lib file compiled with previous versions of visual studio.

To solve the issue, you can try defining __iob_func() yourself which should return an array containing {*stdin,*stdout,*stderr}.

Regarding the other link errors about stdio functions (in my case it was sprintf()), you can add legacy_stdio_definitions.lib to your linker options.

这篇关于未解析的外部符号__imp__fprintf和__imp____iob_func,SDL2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆