to_string()はstdのメンバーではありません
2381 ワード
方法1:
char* PlayLayer::myToString(int count){ char* countBuf = new char[25]; sprintf(countBuf, "%d", count);//point = objectes->getObject(countBuf); return countBuf;
}
to_string()をstd:to_に置き換えるstring()
方法2:
まず
次に、
char* PlayLayer::myToString(int count){ char* countBuf = new char[25]; sprintf(countBuf, "%d", count);//point = objectes->getObject(countBuf); return countBuf;
}
to_string()をstd:to_に置き換えるstring()
方法2:
まず
stdtostring.h
のファイルを書きます.#ifndef STDTOSTRING_H
#define STDTOSTRING_H
#include
#include
using namespace std;
namespace std
{
template < typename T > std::string to_string( const T& n )
{
std::ostringstream stm ;
stm << n ;
return stm.str() ;
}
}
#endif
次に、
std::to_stirng()
メソッドを使用する必要があるソースファイルに含まれます.#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID
#include "stdtostring.h"
#endif
参照:https://blog.csdn.net/Anzhongliu/article/details/51465507