私はアプリケーションを閉じるとこの状態が続きます。 JsonCppと何か関係があることはわかっています.Json値を使用した場合にのみ発生します。JSonCppを使った純粋仮想関数呼び出し
私はJSON値を作成する方法で行うには、その何かを考えるが、私は、私はそれを私のコードは、現在ある
やるべきかは考えていない任意のチュートリアル実際に存在しないよう:
static Json::Value root; // will contains the root value after parsing.
unsigned int WindowSettings::WindowWidth = 800;
unsigned int WindowSettings::WindowHeight = 600;
bool WindowSettings::FullScreen = false;
unsigned short WindowSettings::AntiAliasing = 16;
bool WindowSettings::VSync = false;
short WindowSettings::FrameRateLimit = 60;
AspectRatios WindowSettings::AspectRatio = ar4p3;
Resolutions WindowSettings::Resolution = r800x600;
Json::Value WindowSettings::root = Json::Value();
void WindowSettings::remakeDefault()
{
root["WindowWidth"] = WindowWidth;
root["WindowHeight"] = WindowHeight;
root["FullScreen"] = FullScreen;
root["AntiAliasing"] = AntiAliasing;
root["VSync"] = VSync;
root["FrameRateLimit"] = FrameRateLimit;
root["AspectRatio"] = AspectRatio;
root["Resolution"] = Resolution;
saveToFile("conf.json");
}
bool WindowSettings::saveToFile(const std::string &fileName)
{
Json::FastWriter writer;
// Make a new JSON document for the configuration. Preserve original comments.
std::string outputConfig = writer.write(root);
std::ofstream myfile;
myfile.open (fileName.c_str(), std::ios::out | std::ios::trunc | std::ios::binary);
if (myfile.is_open())
{
myfile << outputConfig.c_str();
myfile.close();
}
return true;
}
は、
私はこれをしないとこのことは起こりません: root ["blah"] = foo;これは既知の問題ですが見つかり
.... 'root [" blah "] = foo'はありませんか? – sehe