Home > Backend Development > C++ > Why am I getting Unresolved External Symbols __imp__fprintf and __imp____iob_func in my SDL2 Visual Studio 2015 Project?

Why am I getting Unresolved External Symbols __imp__fprintf and __imp____iob_func in my SDL2 Visual Studio 2015 Project?

Susan Sarandon
Release: 2024-11-28 09:33:10
Original
266 people have browsed it

Why am I getting Unresolved External Symbols __imp__fprintf and __imp____iob_func in my SDL2 Visual Studio 2015 Project?

Unresolved External Symbols __imp__fprintf and __imp____iob_func in SDL2

When compiling an SDL2 project in Visual Studio 2015, developers may encounter unresolved external symbols __imp__fprintf and __imp____iob_func.

The underlying issue stems from the fact that Visual Studio 2015 defines stdin, stderr, and stdout differently than previous versions. In older Visual Studio releases, these were defined as macros pointing to arrays containing the three standard IO streams. However, in Visual Studio 2015, they are defined using __acrt_iob_func().

As a result, code compiled with previous Visual Studio versions that relies on the older definitions of stdin, stderr, and stdout will encounter an undefined reference to __iob_func() when linking against a library (.lib) compiled with Visual Studio 2015.

To resolve the issue, one solution is to manually define __iob_func() as an array containing {stdin, stdout, *stderr}. This ensures that the code has the necessary reference to __iob_func().

Additionally, any code using stdio functions (e.g., scanf, printf) may also encounter unresolved external symbols. To address this, developers can add the legacy_stdio_definitions.lib to their linker options. This library provides definitions for the missing stdio functions.

The above is the detailed content of Why am I getting Unresolved External Symbols __imp__fprintf and __imp____iob_func in my SDL2 Visual Studio 2015 Project?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template