none
Migrating from VS2010 to VS 2017: Getting error __iob_func: identifier not found RRS feed

  • Question

  • I am migrating code from VS 2010 to VS 2017 & getting errors like "'__iob_func': identifier not found". I tried searching on net and observed that adding legacy_stdio_definitions.lib while linking can resolve the error. But, I couldn't found it on my machine (I am using VS 2017 professional 15.5.1 version. 

    From what I have read so far, I understand that the issue must be related to CRT.

    Can someone please help me to resolve this issue?

    Thursday, June 14, 2018 10:48 AM

All replies

  • Hi,

    thanks for posting here.

    >>Migrating from VS2010 to VS 2017: Getting error __iob_func: identifier not found

    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])

    In my opinion, the legacy_stdio_definitions.lib means the previous version of std lib which you linked in your vs2010.

    Or you could upgrade your project to vs 2017 by using the visual studio tool. When you first open a Visual C++ project that was created in an earlier version of Visual Studio, you might be prompted to update the project. The message asks whether you want to upgrade to the most recent version of the Visual C++ compiler and libraries.

    Hope this could be help of you.

    Best Regards,

    Baron Bi


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, June 15, 2018 1:36 AM
  • First of all, legacy_stdio_definitions.lib is in the Visual C++ directory, you should find it at:

    C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\<vcversion>\lib\<platform>

    assuming C: is your system drive and you installed it in the default location.

    But this won't actually help you. As Baron Bi mentioned, the definitions for these changed in Visual Studio 2015. If you look at the exports for the CRT prior to Visual Studio 2015, you will find that __iob_func is exported from these.

    C:\Windows\System32>dumpbin /exports msvcr110.dll | find "iob_func"
            409  197 0002DF0C __iob_func
    C:\Windows\System32>dumpbin /exports msvcr120.dll | find "iob_func"
            427  1A9 00022C9C __iob_func

    However, if you check the CRT that Visual Studio 2015 and 2017 use, this function isn't exported.

    C:\Windows\System32>dumpbin /exports ucrtbase.dll | find "iob_func"
             55   36 00019520 __acrt_iob_func
            683  2AA 000194E0 _o___acrt_iob_func

    So this is where the linker error is coming from. The implementation was changed.

    So why won't this help you? It is documented here, the various printf and scanf functions were made inline, so the legacy_stdio_definitions.lib file were made to resolve printf, scanf and the variants. But the documentation states:

    " If your project links with static libraries that were compiled with a release of Visual Studio earlier than 2015, the linker might report an unresolved external symbol. These errors might reference internal stdio definitions for iob, _iob_func, or related imports for certain stdio functions in the form of _imp\*. Microsoft recommends that you recompile all static libraries with the latest version of the C++ compiler and libraries when you upgrade a project."

    This is basically saying that if you get these errors, then you should recompile all of your code with Visual Studio 2015 or 2017. In other words, there is nothing in Visual Studio 2015 and 2017 that will resolve _iob_fun.

    If you are using static libraries that references stdin, stdout or stderr directly then you have no option, you must rebuild them using Visual Studio 2017.


    This is a signature. Any samples given are not meant to have error checking or show best practices. They are meant to just illustrate a point. I may also give inefficient code or introduce some problems to discourage copy/paste coding. This is because the major point of my posts is to aid in the learning process.

    • Proposed as answer by RLWA32 Saturday, June 16, 2018 2:30 PM
    Saturday, June 16, 2018 2:20 PM
  • Hi,

    Have you got any updates? If your case has been solved, please help to mark answers. If not, just feel free to contact us.

    Your understanding and cooperation will be grateful.

    Best Regards,

    Baron Bi


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, June 28, 2018 1:46 AM
  • Excuse me, I can't get my Fortran program to compile in VisualStudio2017, because of an error about unresolved symbol "__imp__iob_func". In a practical way, I can I solve this problem? Thanks

    Tuesday, October 29, 2019 3:03 PM
  • Is there something about Darran Rowe's response that is unclear?
    Tuesday, October 29, 2019 5:32 PM
  • Ok, thank you. I've solved the problem! I had to update the external library (in my case it was Metis5.lib)

    Bye bye

    Wednesday, October 30, 2019 9:35 AM