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"

FFbxImporter in an editor plugin (LNK2019)

I'm trying to gain access to the methods found in "Editor/UnrealEd/Private/FbxImporter.h".

I'm incredibly close to getting things to compile, with the exception of unresolved linker errors pertaining to any of the FFbxImporter:* functions that my plugin attempts to use.

Am I missing something in my plugin's build.cs file?

 namespace UnrealBuildTool.Rules
 {
     public class MyFbxEditor : ModuleRules
     {
         private string ModulePath
         {
             get { return ModuleDirectory; }
         }
 
         public MyFbxEditor(TargetInfo Target)
         {
             PublicIncludePaths.AddRange(new string[] {
                 "MyFbxEditor/Public",
                 "AssetTools/Public",
                 "Editor/UnrealEd/Public",
                 "Editor/UnrealEd/Classes"
             });
             
             PrivateIncludePaths.AddRange(new string[] {
                 "MyFbxEditor/Private",
                 "UnrealEd/Private/Settings",
                 "Editor/UnrealEd/Private",
                 "Editor/UnrealEd/Private/Fbx"
             });
 
             AddEngineThirdPartyPrivateStaticDependencies(Target, "FBX");
 
             PublicDependencyModuleNames.AddRange(new string[] {
                 "MyFbxPlugin",
                 "Core",
                 "CoreUObject",
                 "Engine",
                 "InputCore",
                 "UnrealEd",
                 "AssetTools",
                 "EditorStyle",
                 "FBX"
             });
 
             PrivateDependencyModuleNames.AddRange(new string[] {
                 "MyFbxPlugin",
                 "SlateCore",
                 "Slate",
                 "AssetTools",
                 "UnrealEd",
                 "FBX"
             });
         }
     }
 }

I am using the GitHub source version of 4.12

Product Version: UE 4.12
Tags:
more ▼

asked Jul 19 '16 at 12:36 AM in C++ Programming

avatar image

MichaelWion
240 23 39 49

avatar image rantrod Jul 19 '16 at 01:35 AM
avatar image MichaelWion Jul 19 '16 at 02:40 AM

I've already seen that post you've linked. It didn't help, as it didn't pertain to my issue at all.

As described in the title and in the post, they are unresolved linker errors (LNK2019) pertaining to any of the FFbxImporter:* functions that my plugin attempts to use. The includes aren't an issue. The compiler finds them perfectly fine, but the linker can't find the libs for the functions defined in "Editor/UnrealEd/Private/FbxImporter.h"

avatar image MichaelWion Jul 19 '16 at 02:45 AM

Here's an example... If I try to use FFbxImporter::OpenFile, the error is:

Module.MyFbxEditor.cpp.obj : error LNK2019: unresolved external symbol "public: bool __cdecl UnFbx::FFbxImporter::OpenFile(class FString,bool,bool)" (?OpenFile@FFbxImporter@UnFbx@@QEAA_NVFString@@_N1@Z) referenced in function "public: virtual void __cdecl MyFbxEditor::StartupModule(void)" (?StartupModule@MyFbxEditor@@UEAAXXZ) 49>D:\Projects\PluginTest\Plugins\MyFbx\Binaries\Win64\UE4Editor-MyFbxEditor-Win64-DebugGame.dll : fatal error LNK1120: 1 unresolved externals

This leads me to believe I am missing a public/private dependency within my build.cs file. But the problem is figuring out what it is that I'm missing, as it appears to me that I have everything I need in order for this to work.

avatar image MichaelWion Jul 20 '16 at 02:52 AM

I've now made it to where I'm able to use the FBX SDK directly, but it'd still be nice if anybody knows what's stopping me from using UE4's frontend for it (i.e., FFbxImporter::* ).

avatar image rantrod Jul 20 '16 at 05:39 AM

Just to be sure, I think this is how you're supposed to use it (using import as an example): UnFbx::FFbxImporter* FFbxImporter = UnFbx::FFbxImporter::GetInstance(); if (FFbxImporter->ImportFromFile(ImportFilename, FileExtension ))...

avatar image MichaelWion Jul 20 '16 at 07:09 AM

Dude... I appreciate the help and all, but like I said, it's a standard linker error. I can't actually use any of those functions, because the linker complains that it can't find the definitions ( *.obj, *.lib, *.dll ) for them. That means the declarations ( *.h ) exist for them, but their actual implementations ( *.cpp ) couldn't be found after the compiler finished it's job. You should probably google LNK2019 if you don't understand what I'm talking about. It's one of the most common linker errors out there.

avatar image MichaelWion Jul 23 '16 at 08:36 AM

So nobody else knows how to gain access to that class without linker errors? I guess I'll just have to use the FBX SDK directly until 4.13 releases, as I've heard there will be better support for working with FBX files via C++

avatar image FrimaMikBou Feb 21 '17 at 07:41 PM

I know this is old, but did you manage to resolve this issue? I'm currently having the exact same issue with UE4.15.

avatar image MichaelWion Jul 14 '17 at 06:43 PM

It was a long time ago for a now-abandoned project, but IIRC, I got around this by simply integrating the FBX SDK directly into my project, and properly setting up my Module Rules to include Third Party software.

Also note that the answer below is correct... you could always modify a GitHub source build of the engine to change the export prefixes for the included FFbxImporter. But if you aren't comfortable with going down that highly error-prone road, simply include the FBX SDK yourself, as described above.

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

This can't be done without modifying the engine. Classes need to be marked as exported (prefixed with THEMODULENAME_API) for you to be able to use them across modules. If the class is not (as in this case), the only option is to modify the engine code with the prefix.

If you do this, you should ideally then submit a pull request to Epic, they are generally pretty willing to accept these kind of PRs into the engine.

more ▼

answered Jun 17 '17 at 09:04 AM

avatar image

kamrann
2.1k 83 28 118

avatar image manuaganu Jun 23 '17 at 10:09 AM

Is there any other way to load 3D Model file in Game while it is running.I am loading 3d model using Runtime Mesh Component but it is slow down my fps.

avatar image MichaelWion Jul 14 '17 at 06:49 PM

Yes. You can manually import the FBX SDK directly into your project as a third party software (see my comment above). Be aware, however, that you will be working with the SDK and not with the wrapper classes (such as FFbxImporter) that the engine provides, which means you will also be responsible for data management and rendering/RHI... So if this is an issue, then I'm afraid the only solution is to modify a source build of the engine, as described in this answer.

(comments are locked)
10|2000 characters needed characters left
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