Re: Android NDK - undefined reference to `itoa'

1,445 views
Skip to first unread message

Jeffrey Walton

unread,
Feb 20, 2013, 4:16:09 PM2/20/13
to andro...@googlegroups.com
On Wed, Feb 20, 2013 at 8:53 AM, <cras...@web.de> wrote:
> Hi at all,
>
> I hope that someone can help me.
> I have a C-Project and want to use it on Android
> but I got this error "undefined reference to `itoa'"
> and can´t understand what is the problem because
> itoa is a standard function I thought.
http://stackoverflow.com/questions/190229/where-is-the-itoa-function-in-linux

Use snprintf and check for truncation:

char buff [16];
int ret = snprintf(buff, sizeof(buff), "%n", value);
if(ret >= sizeof(buff)
// failed - truncation

Jeff
Reply all
Reply to author
Forward
0 new messages