From other questions that I've been looking through for the past couple of hours, I gather that the link isn't being made correctly when I compile this file I'm using Json::Value as a parameter in my method buildTree. However, I cannot seem to correct this on my own so I'm reaching out for help now.
At the top of my file MovieClient.cpp, I've included the following:
#include <jsonrpccpp/client/connectors/httpclient.h>
#include <jsoncpp/json/value.h>
#include "moviestub.h"
using namespace jsonrpc;
using namespace std;
Not all of these are relevant, as far as I know, but I wanted to include all of those who may matter since I obviously can't figure it out.
I also have the forward declaration:
void buildTree(Json::Value videoList);
The method (note: this is from other source material and I haven't finished customizing it to what I need. I was trying to resolve the error before doing so):
enter c void buildTree(Json::Value videoList){
tree->clear();
cout << endl << "Adding tree nodes for video titles: ";
for(int i=0; i<videoList.size(); i++){
string title = videoList[i].asString();
std::stringstream stream;
stream << "Video"
<< "/" << title;
tree->add(stream.str().c_str());
}
cout << endl;
tree->root_label(appAuthor.c_str());
tree->redraw();
}
It's called in the main method (after the previous method and outside the class):
int main(int argc, char * argv[]) {
std::string nameStr = "Movie Library Catalog";
std::string host = (argc>0)?argv[0]:"127.0.0.1:8888";
MovieClient mc(nameStr,host);
HttpClient httpclient(host);
moviestub m(httpclient);
Json::Value videoList = m.getTitles();
buildTree(videoList);
return (Fl::run());
}
Finally, here's the relevant portion of the build file:
<target name="prepare">
<mkdir dir="${build}"/>
<mkdir dir="${dist}"/>
<mkdir dir="${obj}"/>
<property name="cxxflag" value="-std=c++14"/>
<property name="includepath" value="/usr/local/include"/>
<property name="client.lib.path" value="/usr/local/lib"/>
<property name="client.lib.list" value="jsoncpp,jsonrpccpp-client,jsonrpccpp-common,microhttpd,stdc++,fltk,X11,m,dl,pthread"/>
</target>
<target name="build.java.server"
depends="prepare"
description="Compile Java server sources">
<echo message="http server: java -cp classes:lib/jsonrpcserver.jar server.MovieLibraryHttpServer ${port.num}"/>
<javac srcdir="${src}/java/server"
includeantruntime="false"
destdir="${build}">
<classpath refid="compile.classpath"/>
</javac>
</target>
<target name="generate.client.stub" depends="prepare">
<exec dir="${basedir}" executable="jsonrpcstub">
<arg line="${json.file.name} --cpp-client=moviestub"/>
</exec>
<copy file="moviestub.h" tofile="${src}/cpp/client/moviestub.h"/>
<delete file="moviestub.h"/>
</target>
<target name="build.cpp.client" depends="generate.client.stub"
description="Compile C++ Client">
<cc outtype="executable" subsystem="console"
outfile="${dist}/movieBrowser"
objdir="${obj}">
<compiler name="g++"/>
<compilerarg value="${cxxflag}"/>
<includepath>
<pathelement path="${includepath}"/>
</includepath>
<libset dir="${client.lib.path}" libs="${client.lib.list}"/>
<fileset dir="${src}/cpp/client" includes="MovieClientGui.cpp,MovieClient.cpp"/>
</cc>
</target>
So, is the issue here that Json::Value is not correctly defined? Is a file missing in my list in my build.xml vile? Or am I just not allowed to use Json::Value as a parameter type?
Or is it something else completely?
Aucun commentaire:
Enregistrer un commentaire