MakeLiteralInt Question and Error

What exactly are literal ints and how are they used? An example would really help.

I also get an error whenever I try to call the MakeLiteralInt function.

This is the include in my source file for the function:

#include "Kismet/KismetSystemLibrary.h"

This is my code in the source file:

int j = UKismetSystemLibrary::MakeLiteralInt(0);

This is my error message:

Error 20 error LNK2019: unresolved external symbol “public: static int __cdecl UKismetSystemLibrary::MakeLiteralInt(int)” (?MakeLiteralInt@UKismetSystemLibrary@@SAHH@Z) referenced in function “public: __cdecl AIntroToProgCharacter::AIntroToProgCharacter(class FObjectInitializer const &)” (??0AIntroToProgCharacter@@QEAA@AEBVFObjectInitializer@@@Z) C:\Users\Documents\Unreal Projects\IntroToProg\Intermediate\ProjectFiles\IntroToProgCharacter.cpp.obj IntroToProg

So I resolved my error by just simply using the source code from the method directly. I am still a little confused as to what literal ints and if they are different from regular ints.

MakeLiteralInt (along with the other MakeLiteral functions) is simply a helper function for use in blueprints. The value passed into the function can be set in the blueprint node, and is then available on the output pin.

Of course, you could instead just enter that same value in to whatever input pin that output pin’s connected to. The advantage here is that it allows you to connect the output to multiple input pins, ensuring that when you change the single int value, it changes for all of the connected pins.

There’s no reason to use UKismetSystemLibrary::MakeLiteralInt outside blueprints. It’s giving you a linker error because UKismetSystemLibrary is not declared as a public API class.

Thank you for the explanation Sneftel. It does help expalin what MakeLiteralInt does and how it is used.