• vs2017.unresolved external symbol __imp__fprintf&__imp____iob_func


    1、我的处理:

    extern "C" { FILE __iob_func[3] = { *stdin,*stdout,*stderr }; }
    #pragma comment(lib, "legacy_stdio_definitions.lib")

    2、

    3、vs2015无法解析外部符号__imp__fprintf - ubosm - 博客园.html (https://www.cnblogs.com/ubosm/p/5444919.html

     网页内容保存:

    使用vs2015编译ffmpeg的一个小项时,出现了__imp__fprintf和__imp____iob_func 的错误,google了一下,有的人 建议下载SDL源码重新编译一下,当然这个方案非常不科学。所以又继续搜,终于有所发现。

    这是老外的原话:

    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.

    答题意思就是stdin, stderr, stdout 这几个函数vs2015和以前的定义得不一样,所以报错。

    解决方法呢,就是使用{*stdin,*stdout,*stderr}数组自己定义__iob_func()

    其实就是下边这样。

    extern "C" { FILE __iob_func[3] = { *stdin,*stdout,*stderr }; }

    然后__imp__fprintf的解决方法就是在链接器输入lib里加上legacy_stdio_definitions.lib这个LIB

    4、

    5、

  • 相关阅读:
    Go语言之Go语言文件处理
    Go语言之Go语言网络编程
    Go语言之Go语言并发
    Go语言之Go语言锁机制
    Go语言之Go语言 异常处理与测试
    Go语言之Go语言反射
    Go语言之Go 语言方法
    Go语言之递归函数
    js 改变文章字体大小
    .net获取当前url各种属性(文件名、参数、域名、端口等)的方法(转)
  • 原文地址:https://www.cnblogs.com/cppskill/p/13381944.html
Copyright © 2020-2023  润新知