x

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"

LNK2019 errors when building standalone with plugin

I created a project from one of the pre-made samples (third person shooter, specifically), and created a very simple plugin which would print the FPS as a debug message. I'm trying to compile it as a standalone executable. It works in Play In Editor, but when trying to Launch the game from the editor or build from Visual Studio using the Development configuration (as opposed to DevelopmentEditor) it fails. I get the following error:

 1>UELinkerFixups.cpp.obj : error LNK2019: unresolved external symbol "void __cdecl EmptyLinkFunctionForStaticInitializationMyPlugin(void)" (?EmptyLinkFunctionForStaticInitializationMyPlugin@@YAXXZ) referenced in function "void __cdecl UELinkerFixups(void)" (?UELinkerFixups@@YAXXZ)
 1>C:\Users\cognimancer\Documents\Unreal Projects\AppTest0\Binaries\Win64\AppTest.exe : fatal error LNK1120: 1 unresolved externals

On the other hand, when I right click the MyPlugin.uproject file and select Launch Game, it launches in a window - looks a lot like a standalone exe, but I don't see an executable being generated anywhere.

What might be causing this? The plugin uses no third party libraries, and removing the FPS printout code doesn't help it run. It looks like a problem between the engine and the plugin, but the plugin works fine in the editor. I've tried DebugGame and Development configs, both in x64.

The plugin is as barebones as I can make it, pretty much just the minimum code needed for a plugin.

MyPlugin.Build.cs

 using UnrealBuildTool;
 using System.IO;
  
 public class MyPlugin : ModuleRules
 {
 
 Path.GetDirectoryName(RulesCompiler.GetModuleFilename(this.GetType().Name)); }
 
     public MyPlugin(TargetInfo Target)
     {
         PrivateIncludePaths.AddRange(new string[] { "MyPlugin/Private", "MyPlugin/Classes" });
  
         PublicDependencyModuleNames.AddRange(new string[] { "Engine", "Core", "CoreUObject" });
     }
 }

MyPlugin.uplugin

 {
     "FileVersion" : 1,
  
     "FriendlyName" : "Test Plugin",
     "Version" : 1,
     "VersionName": "1.0",
     "EngineVersion" : "4.4",
     "Description" : "Prints FPS to screen."
     "Category" : "Runtime",
     "CreatedBy" : "cognimancer",
  
     "Modules" :
     [
         {
             "Name" : "MyPlugin",
             "Type" : "Runtime"
         } 
     ]
 }
Product Version: Not Selected
Tags:
more ▼

asked Oct 03 '14 at 06:33 PM in Packaging & Deployment

avatar image

cognimancer
236 11 101 160

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

Found the problem! It was in my ___Plugin.cpp file, where the IMPLEMENT_MODULE macro is used. I was giving it Module as the second argument (not sure where that came from, probably copied from sample code), when it should have been given MyPlugin.

more ▼

answered Oct 06 '14 at 10:18 PM

avatar image

cognimancer
236 11 101 160

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

I also ran into this problem and it took me a bit to figure out. Your solution wasn't the same as my solution.

My issue: in my root folder I have a source file which is named [ProjectName].cpp (in my case, "magemaster2.cpp"). Within there, was a line which said:

 IMPLEMENT_PRIMARY_GAME_MODULE( FDefaultGameModuleImpl, MageMaster, "MageMaster" );

This is wrong. The game module needs to reflect the project name, so I changed it to:

 IMPLEMENT_PRIMARY_GAME_MODULE( FDefaultGameModuleImpl, MageMaster2, "MageMaster2" );

and it worked.

I have no idea how this got changed or why it wasn't causing problems in the past. Regardless, this is where you should look if you get these types of linker errors.

more ▼

answered Feb 04 '15 at 08:09 PM

avatar image

Slayemin
834 50 29 74

(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