0
Jsoncppを使用してJsonメッセージを作成しようとしています。 次のように私がやった:JsonCppを使用してJsonメッセージを作成する
clients.cpp:(.text._ZN20multi_usrp_emulation7client1Ev[_ZN20multi_usrp_emulation7client1Ev ]+0x1d9): undefined reference to `Json::Value::operator=(Json::Value)'
clients.cpp:(.text._ZN20multi_usrp_emulation7client1Ev[_ZN20multi_usrp_emulation7client1Ev ]+0x224): undefined reference to `Json::Value::operator=(Json::Value)'
clients.cpp:(.text._ZN20multi_usrp_emulation7client1Ev[_ZN20multi_usrp_emulation7client1Ev ]+0x26c): undefined reference to `Json::Value::operator=(Json::Value)'
collect2: error: ld returned 1 exit status
私のコードが間違っているもの:
g++ -o clients clients.cpp -ljsoncpp -lzmq
この種のエラーが発生します。
#include <string>
#include <iostream>
#include <sstream>
#include <json/json.h>
int main()
{
std::string Value = "5.17e9";
std::string Type = "TX";
std::string Parameter = "Frequency";
Json::Value root;
root.append("Type");
root.append("Parameter");
root.append("Value");
root["Type"] = Type;
root["Parameter"] = Parameter;
root["Value"] = Value;
Json::FastWriter fastwriter;
std::string message = fastwriter.write(root);
std::cout<<message<<std::endl;
return 0;
}
は、次のコマンドラインを使用してこのコードをコンパイルします?
あなたがjsoncppのどのバージョンを使用していますか?おそらくそれはこの問題に関連しています:https://github.com/open-source-parsers/jsoncpp/issues/484? –
バージョンの確認方法はありません。しかし、今日はgithub経由でダウンロードしました。私はあなたが添付した質問を読んだが、私はそれをよく理解しなかった。あなたは私を助けることができる? –
バージョンは1.7.2 –