How to load a third-party library from the engine?

I’m writing a plug-in, and I want to use the functionality provided by OpenSSL in my code.
I found OpenSSL in the engine’s ThirdParty directory, but how do I load it? I’m trying to add “OpenSSL” to “PrivateDependencyModuleNames” and “DynamicallyLoadedModuleNames” in *.build.cs, but it doesn’t work, and when I #include “ssl.h”, it’s always prompted to fail to open the source file.
What method should I use to load it? Please help me.

Are you working on Win64 platform?

If using openssl directly.

In your .Build.cs:

PrivateDependencyModuleNames.AddRange(new string[] {  "OpenSSL"});

In your code:

namespace mynamespace
{
#include "openssl/bio.h"
#include "openssl/ssl.h"
#include "openssl/err.h"
}

Thank you for your reply.
Another problem I find in OpenSSL. Build.cs is the use of version Numbers for Visual Studio. With the only version of the engine in 2015, is the UE not yet compatible with Visual Studio2017?

So does this switch need to be written by myself?

VS2017 is supported in UE 4.15. View code in UBT to check the compatibility.

public static string GetVisualStudioCompilerVersionName()
{
	switch (Compiler)
	{
		case WindowsCompiler.VisualStudio2013:
			return "2013";
		case WindowsCompiler.VisualStudio2015:
			return "2015";
		case WindowsCompiler.VisualStudio2017:
			return "2015"; // VS2017 is backwards compatible with VS2015 compiler

		default:
			throw new BuildException("Unexpected WindowsCompiler version for GetVisualStudioCompilerVersionName().  Either not using a Visual Studio compiler or switch block needs to be updated");
	}
}

No, the code is from Engine UEBuildWindows.cs. Just compile your code, UBT will handle it.

When you got that error. Compling or coding? would you please post a screenshot here?

I got this error when i coding.I uninstalled VS2017 and is installing VS2015, which may not be able to provide a screenshot, which is in # include and there is a red line error here.

So why is it that when I use VS2017 it prompts “unable to open source files”? I’ve already included OpenSSL in build.cs.

Can you compile your project? Or just can not open the header files in your IDE. Try to regenerate your solution files, check whether the SSL include directories is found in NMAKE include search path.

PrivateDependencyModuleNames.AddRange(
new string[]
{
“CoreUObject”,
“Engine”,
“Slate”,
“SlateCore”,
“Sockets”,
“Networking”,
“OpenSSL”,
// … add private dependencies that you statically link with here …
}
);

I added OpenSSL here.
If i do not include “openssl/ssl.h”, no problem will occur.
But if I include “openssl/SSL. H”, there will be a bunch of errors. Whether it is at compile time or in the IDE.

![138431-qjiv1e$@(z@c)eu{z(@k.png|732x200

Hey man, show the error of Build only. Disable intelliSense error report . “生成+IntelliSense” → “Build Only”.

Try to compile the blank SSL plugin. Then Let’s see link textwhat it say.

I compiled the project you provided.VS only hints at several warnings.

![138458-5x}@oho232@$ae}dzq801j.png|757x174

If I want to create a BlueprintLibrary, what should I do?

Well, it is another topic .

Show you an example here.

[link text][1]
[1]: 138461-testssl1.zip (22.8 KB)

UBT uses .build.cs to find module dependencies, and handle include dirs and other paths for you. So you have to determine your module’s dependencies in your build.cs. The description documentation is here: [https://docs.unrealengine.com/latest/INT/Programming/UnrealBuildSystem/ModuleFiles/][1]

Thank you again.

Thank you very much for your answer.
So if I want to use other modules in my plug-in, do I have to add it to PublicDependencyModuleNames?