프로그래밍/예전글
cocos2d-x NDK r10c 필드에서 to_string 지원이 안됨(stringstream의 사용)
Cat체셔
2015. 6. 10. 20:10
현재 cocos2d-x 3.4버전(ndk r10c)를 사용중인데
ios에서는 to_string사용이 가능하나
android빌드시 error: 'to_string' was not declared in this scope 에러를 뱉습니다.
ndk r10c에서는 to_string함수가 존재하지 않는듯 합니다.
다행히 cocos2d라이브러리 안에 아래의 주석코드가 있네요.
말대로 stringstream을 사용합시다.
// std::to_string is not supported on android, using std::stringstream instead.
string to_string(int value)
{
stringstream strStream;
strStream<<value;
return strStream.str();
}
위와 같이 사용을 해주시면 됩니다.