Not able to successfully compile. Undefined references to cpr
This commit is contained in:
+3
-2
@@ -35,11 +35,12 @@ int main(int argc, char** argv)
|
||||
}
|
||||
|
||||
cout<<"Song path: "<<songPath<<endl;
|
||||
FileManager fm{songPath};
|
||||
fm.saveFile(newSongPath);
|
||||
|
||||
Upload upS{songPath};
|
||||
upS.uploadSong();
|
||||
|
||||
FileManager fm{songPath};
|
||||
fm.saveFile(newSongPath);
|
||||
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
#include"Download.h"
|
||||
|
||||
Download::Download() { }
|
||||
@@ -0,0 +1,16 @@
|
||||
#ifndef DOWNLOAD_H_
|
||||
#define DOWNLOAD_H_
|
||||
|
||||
#include<iostream>
|
||||
|
||||
namespace Syncers
|
||||
{
|
||||
class Download
|
||||
{
|
||||
public:
|
||||
Download();
|
||||
private:
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
+12
-1
@@ -1,6 +1,7 @@
|
||||
#include<iostream>
|
||||
#include<string>
|
||||
|
||||
#include<cpr/cpr.h>
|
||||
#include<nlohmann/json.hpp>
|
||||
|
||||
#include"Upload.h"
|
||||
@@ -11,12 +12,15 @@ using std::string;
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
using namespace cpr;
|
||||
|
||||
namespace Syncers
|
||||
{
|
||||
Upload::Upload() { }
|
||||
Upload::Upload(string filePath)
|
||||
{
|
||||
this->fMgr = Managers::FileManager{filePath};
|
||||
this->songPath = filePath;
|
||||
this->fMgr = Managers::FileManager(songPath);
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +30,13 @@ namespace Syncers
|
||||
json jObj = serializeObject();
|
||||
printJsonData(jObj);
|
||||
|
||||
std::string url = apiUrl + apiEndPoint;
|
||||
|
||||
auto r = cpr::Post(cpr::Url{url},
|
||||
cpr::Multipart{{"key", "file"},
|
||||
{"value", cpr::File{songPath}}});
|
||||
cout << r.text << std::endl;
|
||||
|
||||
}
|
||||
|
||||
void Upload::configureSong()
|
||||
|
||||
@@ -23,7 +23,8 @@ namespace Syncers
|
||||
Managers::FileManager fMgr;
|
||||
Models::Song song;
|
||||
std::string apiUrl{"http://192.168.1.24"};
|
||||
std::string apiEndPoint{"/api/song"};
|
||||
std::string apiEndPoint{"/api/song/data"};
|
||||
std::string songPath;
|
||||
int port{9349};
|
||||
|
||||
void configureSong();
|
||||
|
||||
Reference in New Issue
Block a user