# Using libcurl within a Plugin

**URL:** <https://forums.unrealengine.com/t/using-libcurl-within-a-plugin/412318>\
**Category:** Plugins\
**Tags:** unreal-engine, Plugins, UE4, CPP, question\
**Created:** [December 15, 2017, 3:56pm UTC](https://forums.unrealengine.com/t/using-libcurl-within-a-plugin/412318 "2017-12-15T15:56:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![DickKickem](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DickKickem](https://forums.unrealengine.com/u/DickKickem)\
**Post date:** [December 15, 2017, 3:56pm UTC](https://forums.unrealengine.com/t/using-libcurl-within-a-plugin/412318/1 "2017-12-15T15:56:22Z")

</div>

Hello everyone.

I’ve been trying to use libcurl in my plugin, but I’ve hit several brick walls.

First, I’ve tried to use the included libcurl, but no dice.

Secondly, I grabbed the libcurl and plopped it in the project’s ThirdParty folder, and then adding it to my plugin’s Build.cs via `PublicIncludePaths.Add` and `PublicAdditionalLibraries.Add`, but again it failed.

The error messages that I’m getting over and over are these:

```
  [2017.12.15-10.09.38:241][751]CompilerResultsLog: New page: Compilation - 15 Dec 2017 14:09:38
  [2017.12.15-10.09.38:242][751]CompilerResultsLog: Compiling game modules for hot reload
  [2017.12.15-10.09.38:242][751]CompilerResultsLog: Performing 4 actions (4 in parallel)
  [2017.12.15-10.09.38:242][751]CompilerResultsLog: Module.TiniestAnalytics.cpp
  [2017.12.15-10.09.38:242][751]CompilerResultsLog: Module.TiniestAnalytics.gen.cpp
  [2017.12.15-10.09.38:242][751]CompilerResultsLog: C:\Program Files (x86)\Windows Kits\8.1\include\um\winnt.h(536): warning C4005: 'TEXT': macro redefinition
  [2017.12.15-10.09.38:242][751]CompilerResultsLog: Error: c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\HAL/Platform.h(839) : note: see previous definition of 'TEXT'
  [2017.12.15-10.09.38:242][751]CompilerResultsLog: C:\Program Files (x86)\Windows Kits\8.1\include\um\winnt.h(17005): warning C4668: '_APISET_RTLSUPPORT_VER' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
  [2017.12.15-10.09.38:242][751]CompilerResultsLog: C:\Program Files (x86)\Windows Kits\8.1\include\um\interlockedapi.h(73): warning C4668: '_APISET_INTERLOCKED_VER' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
  [2017.12.15-10.09.38:242][751]CompilerResultsLog: C:\Program Files (x86)\Windows Kits\8.1\include\um\processthreadsapi.h(1170): warning C4668: '_WIN32_WINNT_WINTHRESHOLD' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
  [2017.12.15-10.09.38:242][751]CompilerResultsLog: C:\Program Files (x86)\Windows Kits\8.1\include\um\securitybaseapi.h(357): warning C4668: '_APISET_SECURITYBASE_VER' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
  [2017.12.15-10.09.38:242][751]CompilerResultsLog: C:\Program Files (x86)\Windows Kits\8.1\include\um\securitybaseapi.h(472): warning C4668: '_APISET_SECURITYBASE_VER' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
  [2017.12.15-10.09.38:242][751]CompilerResultsLog: C:\Program Files (x86)\Windows Kits\8.1\include\um\securitybaseapi.h(1302): warning C4668: '_APISET_SECURITYBASE_VER' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
  [2017.12.15-10.09.38:242][751]CompilerResultsLog: C:\Program Files (x86)\Windows Kits\8.1\include\um\winbase.h(8618): warning C4668: 'NTDDI_WIN7SP1' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
  [2017.12.15-10.09.38:242][751]CompilerResultsLog: Error: c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\HAL/ThreadSafeCounter64.h(67) : error C2039: '_InterlockedIncrement': is not a member of 'FWindowsPlatformAtomics'
  [2017.12.15-10.09.38:242][751]CompilerResultsLog: Error: C:\Program Files\Epic Games\UE_4.17\Engine\Source\Runtime\Core\Public\Windows/WindowsPlatformAtomics.h(14) : note: see declaration of 'FWindowsPlatformAtomics'
  [2017.12.15-10.09.38:242][751]CompilerResultsLog: Error: c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\HAL/ThreadSafeCounter64.h(67) : error C2665: '_InterlockedIncrement': none of the 4 overloads could convert all the argument types
  [2017.12.15-10.09.38:242][751]CompilerResultsLog: C:\Program Files (x86)\Windows Kits\8.1\include\um\winbase.h(8844): note: could be 'unsigned __int64 _InterlockedIncrement(volatile unsigned__int64 *)'
  [2017.12.15-10.09.38:242][751]CompilerResultsLog: C:\Program Files (x86)\Windows Kits\8.1\include\um\winbase.h(8833): note: or 'unsigned long _InterlockedIncrement(volatile unsigned long *)'
  [2017.12.15-10.09.38:242][751]CompilerResultsLog: C:\Program Files (x86)\Windows Kits\8.1\include\um\winbase.h(8824): note: or 'unsigned int _InterlockedIncrement(volatile unsigned int *)'
  [2017.12.15-10.09.38:242][751]CompilerResultsLog: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.11.25503\INCLUDE\intrin0.h(186): note: or 'long _InterlockedIncrement(volatile long *)'
  [2017.12.15-10.09.38:242][751]CompilerResultsLog: Error: c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\HAL/ThreadSafeCounter64.h(67) : note: while trying to match the argument list '(volatile int64 *)'
  [2017.12.15-10.09.38:242][751]CompilerResultsLog: Error: c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\HAL/ThreadSafeCounter64.h(79) : error C2039: '_InterlockedAdd': is not a member of 'FWindowsPlatformAtomics'
  [2017.12.15-10.09.38:242][751]CompilerResultsLog: Error: C:\Program Files\Epic Games\UE_4.17\Engine\Source\Runtime\Core\Public\Windows/WindowsPlatformAtomics.h(14) : note: see declaration of 'FWindowsPlatformAtomics'
  [2017.12.15-10.09.38:242][751]CompilerResultsLog: Error: c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\HAL/ThreadSafeCounter64.h(79) : error C2664: 'LONG _InterlockedAdd(volatile LONG *,LONG)': cannot convert argument 1 from 'volatile int64 *' to 'volatile LONG *'
  [2017.12.15-10.09.38:242][751]CompilerResultsLog: Error: c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\HAL/ThreadSafeCounter64.h(79) : note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
  [2017.12.15-10.09.38:242][751]CompilerResultsLog: Error: c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\HAL/ThreadSafeCounter64.h(90) : error C2039: '_InterlockedDecrement': is not a member of 'FWindowsPlatformAtomics'
  [2017.12.15-10.09.38:242][751]CompilerResultsLog: Error: C:\Program Files\Epic Games\UE_4.17\Engine\Source\Runtime\Core\Public\Windows/WindowsPlatformAtomics.h(14) : note: see declaration of 'FWindowsPlatformAtomics'
  [2017.12.15-10.09.38:242][751]CompilerResultsLog: Error: c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\HAL/ThreadSafeCounter64.h(90) : error C2665: '_InterlockedDecrement': none of the 4 overloads could convert all the argument types
  [2017.12.15-10.09.38:242][751]CompilerResultsLog: C:\Program Files (x86)\Windows Kits\8.1\include\um\winbase.h(8875): note: could be 'unsigned __int64 _InterlockedDecrement(volatile unsigned__int64 *)'
  [2017.12.15-10.09.38:242][751]CompilerResultsLog: C:\Program Files (x86)\Windows Kits\8.1\include\um\winbase.h(8864): note: or 'unsigned long _InterlockedDecrement(volatile unsigned long *)'
  [2017.12.15-10.09.38:242][751]CompilerResultsLog: C:\Program Files (x86)\Windows Kits\8.1\include\um\winbase.h(8855): note: or 'unsigned int _InterlockedDecrement(volatile unsigned int *)'
  [2017.12.15-10.09.38:242][751]CompilerResultsLog: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.11.25503\INCLUDE\intrin0.h(151): note: or 'long _InterlockedDecrement(volatile long *)'
  [2017.12.15-10.09.38:242][751]CompilerResultsLog: Error: c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\HAL/ThreadSafeCounter64.h(90) : note: while trying to match the argument list '(volatile int64 *)'
  [2017.12.15-10.09.38:242][751]CompilerResultsLog: Error: c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\HAL/ThreadSafeCounter64.h(102) : error C2039: '_InterlockedAdd': is not a member of 'FWindowsPlatformAtomics'
  [2017.12.15-10.09.38:242][751]CompilerResultsLog: Error: C:\Program Files\Epic Games\UE_4.17\Engine\Source\Runtime\Core\Public\Windows/WindowsPlatformAtomics.h(14) : note: see declaration of 'FWindowsPlatformAtomics'
  [2017.12.15-10.09.38:242][751]CompilerResultsLog: Error: c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\HAL/ThreadSafeCounter64.h(102) : error C2664: 'LONG _InterlockedAdd(volatile LONG *,LONG)': cannot convert argument 1 from 'volatile int64 *' to 'volatile LONG *'
  [2017.12.15-10.09.38:242][751]CompilerResultsLog: Error: c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\HAL/ThreadSafeCounter64.h(102) : note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
  [2017.12.15-10.09.38:242][751]CompilerResultsLog: Error: c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\HAL/ThreadSafeCounter64.h(114) : error C2039: '_InterlockedExchange': is not a member of 'FWindowsPlatformAtomics'
  [2017.12.15-10.09.38:242][751]CompilerResultsLog: Error: C:\Program Files\Epic Games\UE_4.17\Engine\Source\Runtime\Core\Public\Windows/WindowsPlatformAtomics.h(14) : note: see declaration of 'FWindowsPlatformAtomics'
  [2017.12.15-10.09.38:242][751]CompilerResultsLog: Error: c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\HAL/ThreadSafeCounter64.h(114) : error C2665: '_InterlockedExchange': none of the 4 overloads could convert all the argument types
  [2017.12.15-10.09.38:242][751]CompilerResultsLog: C:\Program Files (x86)\Windows Kits\8.1\include\um\winbase.h(8910): note: could be 'unsigned __int64 _InterlockedExchange(volatile unsigned__int64 *,unsigned __int64)'
  [2017.12.15-10.09.38:242][751]CompilerResultsLog: C:\Program Files (x86)\Windows Kits\8.1\include\um\winbase.h(8898): note: or 'unsigned long _InterlockedExchange(volatile unsigned long *,unsigned long)'
  [2017.12.15-10.09.38:242][751]CompilerResultsLog: C:\Program Files (x86)\Windows Kits\8.1\include\um\winbase.h(8888): note: or 'unsigned int _InterlockedExchange(volatile unsigned int *,unsigned int)'
  [2017.12.15-10.09.38:242][751]CompilerResultsLog: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.11.25503\INCLUDE\intrin0.h(153): note: or 'long _InterlockedExchange(volatile long *,long)'
  [2017.12.15-10.09.38:242][751]CompilerResultsLog: Error: c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\HAL/ThreadSafeCounter64.h(114) : note: while trying to match the argument list '(volatile int64 *, int64)'
  [2017.12.15-10.09.38:242][751]CompilerResultsLog: Error: c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\HAL/ThreadSafeCounter64.h(125) : error C2039: '_InterlockedExchange': is not a member of 'FWindowsPlatformAtomics'
  [2017.12.15-10.09.38:243][751]CompilerResultsLog: Error: C:\Program Files\Epic Games\UE_4.17\Engine\Source\Runtime\Core\Public\Windows/WindowsPlatformAtomics.h(14) : note: see declaration of 'FWindowsPlatformAtomics'
  [2017.12.15-10.09.38:243][751]CompilerResultsLog: Error: c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\HAL/ThreadSafeCounter64.h(125) : error C2665: '_InterlockedExchange': none of the 4 overloads could convert all the argument types
  [2017.12.15-10.09.38:243][751]CompilerResultsLog: C:\Program Files (x86)\Windows Kits\8.1\include\um\winbase.h(8910): note: could be 'unsigned __int64 _InterlockedExchange(volatile unsigned__int64 *,unsigned __int64)'
  [2017.12.15-10.09.38:243][751]CompilerResultsLog: C:\Program Files (x86)\Windows Kits\8.1\include\um\winbase.h(8898): note: or 'unsigned long _InterlockedExchange(volatile unsigned long *,unsigned long)'
  [2017.12.15-10.09.38:243][751]CompilerResultsLog: C:\Program Files (x86)\Windows Kits\8.1\include\um\winbase.h(8888): note: or 'unsigned int _InterlockedExchange(volatile unsigned int *,unsigned int)'
  [2017.12.15-10.09.38:243][751]CompilerResultsLog: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.11.25503\INCLUDE\intrin0.h(153): note: or 'long _InterlockedExchange(volatile long *,long)'
  [2017.12.15-10.09.38:243][751]CompilerResultsLog: Error: c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\HAL/ThreadSafeCounter64.h(125) : note: while trying to match the argument list '(volatile int64 *, int)'
  [2017.12.15-10.09.38:243][751]CompilerResultsLog: Error: C:\Program Files\Epic Games\UE_4.17\Engine\Source\Runtime\Engine\Classes\Engine/TextureCube.h(69) : error C3668: 'UTextureCube::UpdateResourceW': method with override specifier 'override' did not override any base class methods
  [2017.12.15-10.09.38:243][751]CompilerResultsLog: Error: C:\Program Files\Epic Games\UE_4.17\Engine\Source\Runtime\Engine\Classes\Engine/CanvasRenderTarget2D.h(43) : error C3668: 'UCanvasRenderTarget2D::UpdateResourceW': method with override specifier 'override' did not override any base class methods
  [2017.12.15-10.09.38:243][751]CompilerResultsLog: ERROR: UBT ERROR: Failed to produce item: C:\Users\alexg\Documents\Unreal Projects\PluginDevelopment\Plugins\TiniestAnalytics\Binaries\Win64\UE4Editor-TiniestAnalytics-6443.dll
  [2017.12.15-10.09.38:243][751]CompilerResultsLog: Total build time: 15.62 seconds (Local executor: 0.00 seconds)
```

---

<div class="post-metadata">

**Author:** ![Shadowriver](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Shadowriver](https://forums.unrealengine.com/u/Shadowriver)\
**Post date:** [December 15, 2017, 9:07pm UTC](https://forums.unrealengine.com/t/using-libcurl-within-a-plugin/412318/2 "2017-12-15T21:07:09Z")

</div>

You are aware of HTTP module on UE4?

> **[Reading a file online](https://forums.unrealengine.com/questions/325380/reading-a-file-online.html)**
>
> I need to read a sequence of bytes stored in a basic txt file which can be found at a specific url. With a local file path I can use SaveFileToArray() function to store the bytes in a uint8 array, how can I do the same with the given file url?

---

<div class="post-metadata">

**Author:** ![DickKickem](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DickKickem](https://forums.unrealengine.com/u/DickKickem)\
**Post date:** [December 16, 2017, 10:17am UTC](https://forums.unrealengine.com/t/using-libcurl-within-a-plugin/412318/3 "2017-12-16T10:17:16Z")

</div>

Yeah, I am. But the library I’m trying to port is heavily dependant on libcurl. I’d rather not rewrite the whole thing if UE4 offers libcurl.

---

<div class="post-metadata">

**Author:** ![Shadowriver](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Shadowriver](https://forums.unrealengine.com/u/Shadowriver)\
**Post date:** [December 16, 2017, 8:05pm UTC](https://forums.unrealengine.com/t/using-libcurl-within-a-plugin/412318/4 "2017-12-16T20:05:38Z")

</div>

try adding this to build script

```
AddEngineThirdPartyPrivateStaticDependencies(Target, "libcurl");

```

Also you have soem missing definition like you bypassing make system for library you use, you should build the library with it’s own build system. I once tried to use third party library and by using this i was able to build it based on it’s own build system:

> **[A new, community-hosted Unreal Engine Wiki](https://forums.unrealengine.com/t/a-new-community-hosted-unreal-engine-wiki/141494)**
>
> After over a year in maintenance mode, the official Unreal Engine Wiki is now permanently offline. These resources now live on a new community-run Unreal Engine Community Wiki — https://unrealcommunity.wiki/! You will be able to find content from...
