Not able to successfully compile. Undefined references to cpr

This commit is contained in:
amazing-username
2019-03-20 00:08:47 -04:00
parent 9dcf70b157
commit 1ebc61389b
7 changed files with 40 additions and 4 deletions
+3
View File
@@ -0,0 +1,3 @@
[submodule "cpr"]
path = cpr
url = https://github.com/whoshuu/cpr.git
Submodule
+1
Submodule cpr added at 3d14e61ed2
+3 -2
View File
@@ -35,11 +35,12 @@ int main(int argc, char** argv)
} }
cout<<"Song path: "<<songPath<<endl; cout<<"Song path: "<<songPath<<endl;
FileManager fm{songPath};
fm.saveFile(newSongPath);
Upload upS{songPath}; Upload upS{songPath};
upS.uploadSong(); upS.uploadSong();
FileManager fm{songPath};
fm.saveFile(newSongPath);
return 0; return 0;
+3
View File
@@ -0,0 +1,3 @@
#include"Download.h"
Download::Download() { }
+16
View File
@@ -0,0 +1,16 @@
#ifndef DOWNLOAD_H_
#define DOWNLOAD_H_
#include<iostream>
namespace Syncers
{
class Download
{
public:
Download();
private:
}
}
#endif
+12 -1
View File
@@ -1,6 +1,7 @@
#include<iostream> #include<iostream>
#include<string> #include<string>
#include<cpr/cpr.h>
#include<nlohmann/json.hpp> #include<nlohmann/json.hpp>
#include"Upload.h" #include"Upload.h"
@@ -11,12 +12,15 @@ using std::string;
using json = nlohmann::json; using json = nlohmann::json;
using namespace cpr;
namespace Syncers namespace Syncers
{ {
Upload::Upload() { } Upload::Upload() { }
Upload::Upload(string filePath) 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(); json jObj = serializeObject();
printJsonData(jObj); 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() void Upload::configureSong()
+2 -1
View File
@@ -23,7 +23,8 @@ namespace Syncers
Managers::FileManager fMgr; Managers::FileManager fMgr;
Models::Song song; Models::Song song;
std::string apiUrl{"http://192.168.1.24"}; 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}; int port{9349};
void configureSong(); void configureSong();