Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How to use free functions present in a plugin, in my current game project?


I have a plugin which has a free functions declared in a header file and defined in a cpp file.

The header file is present in Classes folder and cpp file is in private folder.

When i try to use this free function in my game project, it is giving me this linker error:

 >MyActor.cpp.obj : error LNK2019: unresolved external symbol "void __cdecl Something(void)" (?Something@@YAXXZ) referenced in function "public: virtual void __cdecl AMyActor::OnConstruction(struct FTransform const &)" (?OnConstruction@AMyActor@@UEAAXAEBUFTransform@@@Z)

If i declare and define the free function inside the header file, then, it works, but if i separate it, it gives me that linker error.

Please help.

Thank you!

Product Version: UE 4.19
more ▼

asked Jul 17 '18 at 02:29 PM in C++ Programming

avatar image

130 6 7 15

avatar image HarryHighDef Jul 17 '18 at 03:22 PM

Have you got the plugin in your build.cs dependancies?

avatar image Superflare Jul 17 '18 at 03:25 PM

Yes, i have included it in my build.cs like this

 PrivateDependencyModuleNames.AddRange(new string[] { "TestPlugin" });
(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Do you also have the corresponding API macro attached to your function so that it looks something like this?

 void TESTPLUGIN_API Something()
more ▼

answered Jul 18 '18 at 04:38 PM

DarkwindRichard (suspended)
avatar image Superflare Jul 19 '18 at 04:01 PM

Thank you, DarkwindRichard.

I forgot to add MyModulename_API macro in my free function.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question