Download

Third Party library plugin

Here’s my situation :
I have to develop for my internship a C++ Unreal Engine plugin using a 3rd party library I had to create myself. I have been working with the 3rd Party Library plugin template proposed by Unreal, in which I tried to just remplace the ExampleLibrary with my own library (SFSLib).

My issue :
I think I replaced all the lines I could, giving the correct paths to my own .h, .lib and .dll, but when I try to compile project, I get a LNK2019 error unresolved external symbol "__declspec(dllimport) void __cdecl SFSCall(void)", and can’t import my library.

I’m not really familiar with library creation in C++, but here’s the first lines of my header file, if it helps :

#if defined(WIN32) && !defined(SFS_STATIC_LIB)

#ifdef SFS_EXPORTS
#define SFS_API __declspec(dllexport)
#else
#define SFS_API __declspec(dllimport)
#endif
#else
#define SFS_API
#endif

SFS_API void SFSCall(); // Just a call function used to print a message when library is loaded

class SFSBullet
{
public:
        SFS_API void AMethod();

private:
        SFS_API float AnOtherMethod();
};

My cpp file only contains the definitions of the different methods, and includes the header and an extra file :

#include "pch.h"
#include <utility>
#include "SFSLib.h"
#include <cmath>

(I used this guide to create my library : https://docs.microsoft.com/en-us/cpp/build/walkthrough-creating-and-using-a-dynamic-link-library-cpp?view=msvc-160)

I tried the usual techniques to fix it, especially the ones with the Linker settings, but as the project is an Unreal project, I don’t seem to have the same options as a regular C++ project.

Any idea what is my issue and how to fix it ? I tried to give all the informations necessary, but if you need more, I’ll try to find them !