Errors Creating And Linking C++ DLLs

[HR][/HR][HR][/HR]Hi there, I’m a game development student trying to learn how to implement c++ DLLs into Unreal Engine 4 in order to complete one of my assignments.

I’ve been following the tutorial found here: A new, community-hosted Unreal Engine Wiki - Announcements - Unreal Engine Forums

Which is unfortunately mangled due to the loss of support for the tags used to wrap the code. Nevertheless, I’ve tried to reassemble the source code to the best of my ability, and I believe I am very close. My DLL has been compiled successfully, and all that remains is to write the c++ class within Unreal to load the DLL and pull the functions from it.

Following is the code I have attempted to repair in “CreateAndLinkDLLTutBFL.h”



#pragma once
#include "Kismet/BlueprintFunctionLibrary.h"
#include "CreateAndLinkDLLTutBFL.generated.h"

UCLASS() class CREATEANDLINKDLLPROJ_API UCreateAndLinkDLLTutBFL : public UBlueprintFunctionLibrary //ERROR HERE
{
    GENERATED_BODY()

public:

    UFUNCTION(BlueprintCallable, Category = "My DLL Library") static bool importDLL(FString folder, FString name);


    UFUNCTION(BlueprintCallable, Category = "My DLL Library") static bool importMethodGetInvertedBool();

    UFUNCTION(BlueprintCallable, Category = "My DLL Library") static bool importMethodGetIntPlusPlus();

    UFUNCTION(BlueprintCallable, Category = "My DLL Library") static bool importMethodGetCircleArea();

    UFUNCTION(BlueprintCallable, Category = "My DLL Library") static bool importMethodGetCharArray();

    UFUNCTION(BlueprintCallable, Category = "My DLL Library") static bool importMethodGetVector4();


    UFUNCTION(BlueprintCallable, Category = "My DLL Library") static bool getInvertedBoolFromDll(bool boolState);

    UFUNCTION(BlueprintCallable, Category = "My DLL Library") static int getIntPlusPlusFromDll(int lastInt);

    UFUNCTION(BlueprintCallable, Category = "My DLL Library") static float getCircleAreaFromDll(float radius);

    UFUNCTION(BlueprintCallable, Category = "My DLL Library") static FString getCharArrayFromDll(FString parameterText);

    UFUNCTION(BlueprintCallable, Category = "My DLL Library") static FVector4 getVector4FromDll(FVector4 vector4);


    UFUNCTION(BlueprintCallable, Category = "My DLL Library") static void freeDLL();
};


On the line labelled with the comment “//ERROR HERE” I have an “expected a ;” error, presumably due to the fact that there is a space between CREATEANDLINKDLLPROJ_API and UCreateAndLinkDLLTutBFL where it expects one complete class name. However, I’ve looked over the tutorial many a time, and there is most definitely a space in the original code. I’ve tried to find other examples via google, but haven’t found anything like what I’m looking for.

Has the line been mangled by the lost code tag support? Or is there something here that has been deprecated, or follows and old syntax and requires modification?

I’m fairly certain correcting this error will fix the errors in my “.cpp” file. Any advice would be appreciated, especially from the original author: ZkarmaKun

EDIT 1 (UPDATE):

So, I figured out that the CREATEANDLINKDLLPROJ_API Macro wasn’t working because it is generated based on the project name, I have since corrected this and now there are only two more errors to take care of.

The most daunting one is here:

I’m going to look into this further, but I figured I’d update the post as soon as the first error was solved.

I tried the only potential fix recommended by VS, adding it to a hint file did not work.

Any insight on how to solve this new error would be greatly appreciated!

EDIT 2 (SOLVED):

Alright, all I had to do to fix the remaining error was recompile my c++ code in order to regenerate the body of code that Macro was referring to.

I was then faced with one final error in Atomic.h that is a common error in the latest version of Unreal right now. You can fix this by making the file write-able, and then adding parenthesis around the whole statement before the ‘?’ operator on the line referenced by the error.

Last but not least, I made this header the first include in my .cpp, and added an include for “Core.h” as it is required to use the FPaths class referenced in the tutorials .cpp.

I HAVE DONE THE SAME, AND HAD THE SAME PROBLEMS. The link says it’s updating, I assume it’s related to the fact I’m using VS 2017 not 2015?