2015-11-26 40 views
-1

我正在用C++編寫帶有nxtOSEK的Lego Nxt Brick。看來stdlib.h庫不工作,但string.h庫工作正常。有沒有人見過這個?stdlib在nxtOSEK中不工作

我包括

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

我的錯誤

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

即使對於itoa(http://www.cplusplus.com/reference/cstdlib/itoa/)的C++文件中明確指出itoa應該在stdlib.h中,itoa不宣。任何幫助將不勝感激,謝謝。

+0

不,您鏈接的文檔清楚地說明了相反的情況。 「可移植性:這個函數沒有在ANSI-C中定義,也不是C++的一部分,但是被一些編譯器支持。」 – hvd

回答

0

如果您編譯代碼爲C++,你應該更喜歡寫你的include指令是這樣的:

#include <cstdlib> 
#include <cstring> 

請讓我知道,如果它幫助。