Download

Create new function blueprint library = Always give Error unresolved externals

I make a simple function in c++ created from the UE4 Project:

‘‘Add new c++ class>NewFunctionBlueprintLibrary’’ like this:

Adding a simple code into it following a lot of tutorials like this:

.h FILE

.cpp FILE

And i always get an error ‘‘1 unresolved externals’’

i make all the stuff in the right way and also i tried to copy and paste codes from other tutorials but it simple dosnt works for me.

(Im using visual studio 2019 and i choose ‘‘visual studio 2019’’ in the editor preferences)

Tutorials references:
https://nerivec.github.io/old-ue4-wiki/pages/blueprint-function-library-create-your-own-to-share-with-others.html

According to the docs: “… Methods in subclasses are expected to be static, and no methods should be added to this base class.” Try making the function static.

As @STRiFE.x said, you definitely need to mark your function as static, but also you cannot have the UFUNCTION macro in the cpp file. Also, the cpp file’s function isn’t implemented.

So, what you need to do is tear out all of your function’s code and replace it with this:

Header file:

// ...
UFUNCTION(BlueprintCallable)
static int32 FunctionSuma(int32 numero1, int32 numero2);
// ...

Cpp File:

// ...
int32 UMyBlueprintFunctionLibrary::FunctionSuma(int32 numero1, int32 numero2) {
    // Put your code here
    return 0; // Replace 0 with whatever value you want to return
}

Also, you could replace UFUNCTION(BlueprintCallable) with UFUNCTION(BlueprintPure) if you want your function to have no Exec pins in the blueprint. (As long is this function doesn’t modify any object’s values)

OMG it working now finally, im so happy now :slight_smile: thankyou @STRiFE.x @NachoMonkey2 for your help!

I’ll put the final result

.h


.cpp

final result

1 Like