I am trying to use the function snprintf() in the #include<stdio> library. However, when I build I find the function does not exist. When I open up the "stdio library" file, I see it is from 1986-1999 and that function does not exist.
However, I have another project where I also use the function snprintf() in the #include<stdio> library and I have no issue. When I open up the "stdio library" file, I see it is from 2003-2010 and the function exists.
How do I include the more recent library such that I can use this function?
Hi Beau,
/* - STDIO.H -
Subset of ANSI standard I/O function declarations.
$Revision: 49720 $
#ifndef _STDIO_INCLUDED
#define _STDIO_INCLUDED
#ifndef _SYSTEM_BUILD
#pragma system_include
#endif
#include "sysmac.h"
#include "stdarg.h"
#ifndef NULL
#define NULL ((void *) 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 int scanf(const char *,...);
__EFF_NW1NW2 __SCANFPR MEMORY_ATTRIBUTE int sscanf(const char *,
const char *,...);
__EFF_NR1 MEMORY_ATTRIBUTE char *gets(char *);
#endif /* _STDIO_INCLUDED */
Regards,
James
Hey James,
You were right, I am using IAR version 7.12.1 and the problem was in the library configuration. The setting was originally CLIB and I should be using NORMAL DLIB to use the more updated library.
Thanks for the help,
Nice work! Thanks for letting the community know what helped solve the issue. I'll mark the thread as resolved.
Regards,
James