fatal error lnk1120 unresolved externals with a plugin which contains .lib

Hello, I’m trying to package a project with this SVG plugin, I check with ChatGPT and the web, I updated my Build.cs file, I tried to include the luna lib like this (and other variants):

		/*string LunaSVGRoot = Path.Combine(ModuleDirectory, "../../Plugins/SVG/Source/ThirdParty/lunasvg/");

		// Windows x64 configuration.
		if (Target.Platform == UnrealTargetPlatform.Win64)
		{
			// Adds lunasvg includes.
			PrivateIncludePaths.Add(Path.Combine(LunaSVGRoot, "inc/x64-windows/"));

			// Adds lunasvg library.
			PublicAdditionalLibraries.Add(Path.Combine(LunaSVGRoot, "lib/x64-windows/lunasvg.lib"));
			PublicAdditionalLibraries.Add(Path.Combine(LunaSVGRoot, "lib/x64-windows/plutovg.lib"));
		}*/
		//PublicAdditionalLibraries.Add(Path.Combine("Plugins/SVG/Source/ThirdParty/lunasvg/", "lib/x64-windows/lunasvg.lib"));

        string SVGDir = Path.Combine(ModuleDirectory, "../../Plugins/SVG/");
        string includeDir = Path.Combine(SVGDir, "Source/ThirdParty/lunasvg/");
		string libFile = Path.Combine(includeDir, "lib/x64-windows/lunasvg.lib");
		
		PublicIncludePaths.Add(includeDir);
		PublicPreBuildLibraries.Add(libFile);

I got these errors and I’m stuck for days to solve it,

“UATHelper: Packaging (Windows): Module.SVG.cpp.obj : error LNK2019: symbole externe non r solu “declspec(dllimport) public: cdecl lunasvg::Bitmap::Bitmap(int,int)” (imp_??0Bitmap@lunasvg@@QEAA@HH@Z) r f renc dans la fonction “public: cdecl FSVGBitmap::FSVGBitmap(unsigned int,unsigned int)” (??0FSVGBitmap@@QEAA@II@Z)”

This plugin contain a c++ dependency with luna, I paste here a part of his Build.cs


        string LunaSVGRoot = Path.Combine(PluginDirectory, "Source/ThirdParty/lunasvg/");

        if (Target.bBuildEditor)
        {
            PrivateDependencyModuleNames.AddRange(new string[]
            {
                "UnrealEd",
                "SlateCore",
                "Slate",
                "DesktopPlatform",
            });
        }

        // Windows x64 configuration.
        if (Target.Platform == UnrealTargetPlatform.Win64)
        {
            // Adds lunasvg includes.
            PrivateIncludePaths.Add(Path.Combine(LunaSVGRoot, "inc/x64-windows/"));

            // Adds lunasvg library.
            PublicAdditionalLibraries.Add(Path.Combine(LunaSVGRoot, "lib/x64-windows/lunasvg.lib"));
            PublicAdditionalLibraries.Add(Path.Combine(LunaSVGRoot, "lib/x64-windows/plutovg.lib"));
        }

someone has an idea?

It seems that moving the SVG plugin from one folder to another folder (still in the Plugins folder) allows packaging. For example from Plugins/Marketplace to Plugins. It worked for me, then the error came back again, I recreated a Marketplace folder in Plugins, put the SVG folder in it, and it was good again.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.