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.
我正在尝试使用 #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