C++ コードに jsoncpp ライブラリを実装しようとしています。試してみるためだけに簡単なコードを書きましたが、コンパイルさえしていません。
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#ifndef json_included
#define json_included
#include "jsoncpp\include\json\json.h"
#endif
//#include "json\jsonC\json.h"
int main(int argc, char **argv)
{
std::string example = "{\"array\":[\"item1\", \"item2\"], \"not an array\":\"asdf\"}";
Json::Value value;
Json::Reader reader;
bool parsed = reader.parse(example, value, false);
std::cout << parsed;
return 0;
}
私が得ているエラーは次のとおりです。
undefined reference to `Json::Reader::parse(std::string const&, Json::Value&, bool)'
undefined reference to `Json::Reader::Reader()'
undefined reference to `Json::Value::~Value()'
undefined reference to `Json::Value::Value(Json::ValueType)'
私は C++ に少し慣れていません。インクルード ステートメントに欠けているものはありますか? それとも、jsonCpp には何か特別なものが必要ですか?
お時間をいただきありがとうございます!