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

What is the error?

Here’s a link that might help: Cannot open include file: 'FbxImporter.h': No such file or directory - Pipeline & Plugins - Epic Developer Community Forums

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"

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.

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::* ).

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 ))…

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.

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++

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

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.

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.

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.

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.

if u want to call FFbxImporter::GetSceneInfo , please try to add UNREALED_API before bool GetSceneInfo , like:

old: bool GetSceneInfo
new: UNREALED_API bool GetSceneInfo