This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] MSP430F149:IAR #include <stdio>提供1986-1999年的 stdio 文件

Guru**** 2253470 points
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/753425/msp430f149-iar-include-stdio-give-a-stdio-file-from-1986-1999

器件型号:MSP430F149

我正在尝试使用 #include 中的函数 snprintf() 库。 但是、当我构建时、我发现该函数不存在。 当我打开"stdio library"文件时、我看到它来自1986-1999、该函数不存在。
但是,我还有另一个项目,在该项目中,我还使用 #include 中的函数 snprintf() 我没有问题。 当我打开"stdio library"文件时、我看到它来自2003-2010、并且函数存在。
如何包含较新的库以便可以使用此函数?

谢谢、

Beau

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Beau、

    您使用的是哪个版本的 IAR? 我有 IAR EW430 7.12.2、在"C:\Program Files (x86)\IAR Systems\Embedded Workbench 8.0\430\inc\clib"文件夹中、我找到了"stdio.h"文件。 在顶部、它显示了"Copyright 1986 - 1999 IAR Systems"。 但是,我在该文件中找到了 sprintf()函数,如下所示。 也许您可以更新失败项目的包含路径、或者使用具有此函数的文件替换该文件。

    /* - stdio.H -
    
    ANSI 标准 I/O 函数声明的子集。
    
    $Revision:49720 $
    
    Copyright 1986-1999 IAR Systems。 保留所有权利。
    //
    
    #ifndef _stdio_included
    #define _stdio_included
    
    #ifndef _system_build
    #pragma system_include
    #endif
    
    #include "SYSMAC.h"
    #include "stdarg.h"
    
    #ifndef
    #define NULL (((void *) 0) 0)
    #endif
    
    #ifndef EOF
    #define EOF (-1)
    #endif
    
    #ifndef memory_attribute
    #define memory_attribute
    #endif
    
    #ifdef _has_pragma _printf_args
    #define __PRINTFPR _Pragma ("__printf_args")\
    _Pragma ("library_default_requirements _formatted_write = unknown")
    #define __SCANFPR _Pragma ("__scanf_args")\
    _Pragma ("library_default_requirements _formatted_read = unknown")
    #else
    #define __PRINTFPR
    #define __SCANFPR
    #endif
    
    __EFF_NW1 memory_attribute int puts (const char *);
    memory_attribute int putchar (int);
    memory_attribute int getchar (void);
    __EFF_NR1NW2 __PRINTFPR memory_attribute int sprintf (char *、const char *、...);
    __EFF_NR1NW2 __PRINTFPR memory_attribute int vsprintf (char *、const char *、
    va_list);
    __EFF_NW1 __PRINTFPR memory_attribute int printf (const char *、...);
    __EFF_NW1 __PRINTFPR memory_attribute int vprintf (const char *、va_list);
    __EFF_NW1 _SCANFPR memory_attribute _ vprintf (const char *、var_list);__nf
    (const char nw_nf *_nw_nf 属性_
    const char *、...);
    __EFF_nr1 memory_attribute char * gets (char *);
    
    
    #endif /*_stdio_included * 

    此致、

    James

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    James、您好、

    您说得对、我使用的是 IAR 版本7.12.1、问题出在库配置中。 该设置最初是 CLIB、我应该使用正常的 DLIB 来使用更新更好的库。
    感谢您的帮助、
    Beau
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    很棒的工作! 感谢您让社区了解帮助解决该问题的方法。 我将该线程标记为已解决。

    此致、

    James