How to include ‘snprintf’
How to include ‘snprintf’
Hi,
I have code that uses the built in function snprintf(). This works fine, but the compiler gives the following warning:
warning: implicit declaration of function ‘snprintf’ [-Wimplicit-function-declaration]
I have stdio.h included, and have set the language standard to C99, but I still get the warnings.
Any clues on what could be the issue here?
Peter
Hello Peter,
Unfortunately, “stdio.h” in optlib does not contain a declaration for snprintf. You can edit the file, usually found in a path similar to “C:\Program Files (x86)\GCC for Renesas RL78 4.9.2.201703-GNURL78-ELF\rl78-elf\rl78-elf\rl78-elf\optlibinc\stdio.h” and add the declaration:
int snprintf ( char * s, size_t n, const char * format, ... );
Alternatively, you can use the above declaration in a file in your own project.
We will fix this in a future release.
–
Best Regards,
Grigore Dobra,
The GNU Tools Team