asprintf

Asked by S.

I have some older code that uses Newlib's asprintf() function. This code has been compiled with a custom toolchain based on Newlib 1.19 stable release if I remember correctly.
Now I was trying to compile the code with the toolchain provided here which is also based on Newlib, so I thought it should be compatible. However, I get some "implicit declaration" warnings:

- implicit declaration of function 'asprintf'
- implicit declaration of function 'strcasestr'
- implicit declaration of function 'vasprintf'

The corresponding headers are included, though, as described in Newlib's documentation.
Also, the code seems to work. So why do I get these warnings?

Thanks for any help.

Question information

Language:
English Edit question
Status:
Solved
For:
GNU Arm Embedded Toolchain Edit question
Assignee:
No assignee Edit question
Solved by:
S.
Solved:
Last query:
Last reply:
Revision history for this message
S. (k2k) said :
#1

Ok, found out this questions answers the problem:

https://answers.launchpad.net/gcc-arm-embedded/+question/237809

Revision history for this message
S. (k2k) said :
#2

Actually, I was wrong. Adding -std=gnu99 to my compiler options, as suggested in the answer referenced above, just rearranged the warnings so that I did not see them any more.
What you really have to do is to define the _GNU_SOURCE flag (e.g. by adding -D_GNU_SOURCE). This will explicitly enable the missing non-standard function prototypes and fix the warnings.