-1

I am programming the Lego Nxt Brick with nxtOSEK in C++. It seems that the stdlib.h library is not working, but the string.h library works fine. Has anyone seen this before?

my includes

#include <string.h>
#include <stdlib.h>

my error

LegoQueue.cpp: In function ‘void queue::debugstring(char*)’:
LegoQueue.cpp:131: error: ‘itoa’ was not declared in this scope

Even though the c++ documentation for itoa (http://www.cplusplus.com/reference/cstdlib/itoa/) clearly states that itoa should be in stdlib.h, itoa is not declared. Any help would be appreciated, thanks.

ysdx
  • 8,889
  • 1
  • 38
  • 51
MyrionSC2
  • 1,248
  • 1
  • 14
  • 24
  • No, the documentation you link to clearly states the exact opposite. "Portability: This function is not defined in ANSI-C and is not part of C++, but is supported by some compilers." –  Nov 26 '15 at 15:49

1 Answers1

0

If you are compiling your code as C++, you should prefer to write your include directives this way:

#include <cstdlib>
#include <cstring>

Please let me know if it helps.

Ad N
  • 7,930
  • 6
  • 36
  • 80