Problem using JUCE with cpprestsdk

Hi,

I’m relatively new to JUCE and haven’t done any C++ for about 20 years, so quite a learning curve. I’m building a VST plugin which needs to make calls to a REST webservice, using JSON, and posting files and things like that. I’m trying to use cpprestsdk to do this, but I’m not sure how to best include all the dependencies etc via Projucer. I’ve installed the sdk on my Ubuntu Studio machine using apt install and I’m developing in CLion. I can add the headers and CLion happily finds the class definitions. But, I get errors at the linking stage:

/usr/bin/ld: libinspire.a(RemixComponent.cpp.o): undefined reference to symbol 'CONF_modules_unload@@OPENSSL_1_1_0'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/STANDALONE_PLUGIN.dir/build.make:89: inspire] Error 1
make[1]: *** [CMakeFiles/Makefile2:105: CMakeFiles/STANDALONE_PLUGIN.dir/all] Error 2
make: *** [Makefile:84: all] Error 2

I’m really not sure how to solve this and much googling doesn’t seem to have helped. Does anyone have any ideas? Thanks

Not sure what the issue is with including the sdk, but since you say you coming up to speed with things, just want to make sure you aren’t planning to do the rest stuff in processBlock:slight_smile:

No, I’m not planning on doing that! :slight_smile:

I wrote a module for this a couple years back: https://github.com/adamski/RestRequest
It’s a single header file so you can also just drag it into your project.

2 Likes

Thank you for pointing me at this, I had actually built a rather similar so it’s nice to know there is similar thinking out there! I’ve managed to get everything working now thanks to looking through your code and getting used to pass by value rather than reference (:man_facepalming:).

My only issue is that it would be really nice if the JULE URL class would allow specification of the request headers. When making a request with a JSON body the standards say you should set the content-type header appropriately, and this isn’t possible in JUCE at the moment. This also makes it harder on the server side, because web api frameworks use this header to dictate how they handle and parse the request. In my case I have control of the sever and I’ve worked out how to stop it misinterpreting the request, luckily. (JUCE essentially hard codes the Content-Type header to be once of a few values, all of which aren’t appropriate for posting modern JSON encoded REST requests)