Problem with using external libraries in JUCE (e.g CPP REST SDK, Restless)


#1

Hi. I want to use a library for sending HTTP requests from my VST synth.
JUCE is generating 3 packages: SharedCode, StandalonePlugin, VST. The problem is SharedCode builds successfully, but others not. There is a stack trace like the library didn’t exist in these 2 packages. However, when I check “External Dependencies” folder there is no dependency like http_client, http_request and so on. There are no compilation errors, I can include a library and I can use methods from a library.

On the screen, I am trying to use Restless library. I am building StandalonePlugin. If I comment line: 51 the build will end with success.

2>Synthesizer.lib(PluginEditor.obj) : error LNK2019: unresolved external symbol __imp_curl_global_init referenced in function "public: __cdecl asoni::Handle::Handle(void)" (??0Handle@asoni@@QEAA@XZ)
2>Synthesizer.lib(PluginEditor.obj) : error LNK2019: unresolved external symbol __imp_curl_global_cleanup referenced in function "public: __cdecl asoni::Handle::~Handle(void)" (??1Handle@asoni@@QEAA@XZ)
2>Synthesizer.lib(PluginEditor.obj) : error LNK2019: unresolved external symbol __imp_curl_easy_init referenced in function "public: __cdecl asoni::Handle::Handle(void)" (??0Handle@asoni@@QEAA@XZ)
2>Synthesizer.lib(PluginEditor.obj) : error LNK2019: unresolved external symbol __imp_curl_easy_cleanup referenced in function "public: __cdecl asoni::Handle::Handle(void)" (??0Handle@asoni@@QEAA@XZ)
2>Synthesizer.lib(restless.obj) : error LNK2019: unresolved external symbol __imp_curl_slist_append referenced in function "private: struct asoni::Handle::response __cdecl asoni::Handle::execGet(void)" (?execGet@Handle@asoni@@AEAA?AUresponse@12@XZ)
2>Synthesizer.lib(restless.obj) : error LNK2019: unresolved external symbol __imp_curl_slist_free_all referenced in function "private: struct asoni::Handle::response __cdecl asoni::Handle::execGet(void)" (?execGet@Handle@asoni@@AEAA?AUresponse@12@XZ)
2>Synthesizer.lib(restless.obj) : error LNK2019: unresolved external symbol __imp_curl_easy_setopt referenced in function "private: struct asoni::Handle::response __cdecl asoni::Handle::execGet(void)" (?execGet@Handle@asoni@@AEAA?AUresponse@12@XZ)
2>Synthesizer.lib(restless.obj) : error LNK2019: unresolved external symbol __imp_curl_easy_perform referenced in function "private: struct asoni::Handle::response __cdecl asoni::Handle::execGet(void)" (?execGet@Handle@asoni@@AEAA?AUresponse@12@XZ)
2>Synthesizer.lib(restless.obj) : error LNK2019: unresolved external symbol __imp_curl_easy_getinfo referenced in function "private: struct asoni::Handle::response __cdecl asoni::Handle::execGet(void)" (?execGet@Handle@asoni@@AEAA?AUresponse@12@XZ)
2>C:\Users\Karol\Documents\Synthesizer\Builds\VisualStudio2017\x64\Debug\Standalone Plugin\\Synthesizer.exe : fatal error LNK1120: 9 unresolved externals
2>Done building project "Synthesizer_StandalonePlugin.vcxproj" -- FAILED.
========== Build: 1 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

#2

Did you add the libraries on projucer? Did you set search paths for them?
It needs to be set for every platform and sometimes for each configuration (debug / release)


#3

I will stick to CPP REST sdk because I have .lib file for this and it seems more correct. (I’ve got it by vcpkg)
Debug:


Release:

Project Settings:

I see Projucer helps me with adding libraries to the project, so experimenting with Visual Studio’s properties was unnecessary. It works now, but I receive an exception when I use request from Microsoft’s tutorial:

Debug Assertion Failed!

Program: ...hesizer\Builds\VisualStudio2017\x64\Debug\VST\Synthesizer.dll
File: minkernel\crts\ucrt\src\appcrt\heap\debug_heap.cpp
Line: 996

Expression: __acrt_first_block == header

#4

You shouldn’t put the name of the library in the “Extra library search paths” field - you should instead put the directory of the library (as you have done with the header paths) and put “cpprest_2_10” in the “External libraries to link” field of the exporter.

I’m not sure that’s causing the problem you’ve just posted about though…