USoundFactory error LNK2019: unresolved external symbol

Dear esteemed experts here,

I copied the below codes to import wav files programmatically.

  	// copied from Editor\AudioEditor\AudioEditorModule
  	LLM_SCOPE(ELLMTag::AudioMisc);
  	USoundFactory* SoundWaveFactory = NewObject<USoundFactory>();

  	// Setup sane defaults for importing localized sound waves
  	SoundWaveFactory->bAutoCreateCue = false;
  	SoundWaveFactory->SuppressImportDialogs();
  	//----------------------------------------------

USoundWave* SoundWave = ImportObject(Package, (FName) ManagerPtr->ID, RF_Public | RF_Standalone, *WavPath, nullptr, SoundWaveFactory);

However, I obtained the below error

error LNK2019: unresolved external symbol “__declspec(dllimport) private: static class UClass * __cdecl USoundFactory::GetPrivateStaticClass(void)” (_imp?GetPrivateStaticClass@USoundFactory@@CAPEAVUClass@@anonymous_user_9674a66c) referenced in function “class USoundFactory * __cdecl NewObject(class UObject *)” (??$NewObject@VUSoundFactory@@@@YAPEAVUSoundFactory@@PEAVUObject@@@Z)
2> Hint on symbols that are defined and could potentially match:

I tried adding the below to myProj.build.cs and still obtain the same error

Basically I copied almost everything from AudioEditor.Build.cs.

  // Circular references that need to be cleaned up
  CircularlyReferencedDependentModules.AddRange
  (
  	new string[]
  	{
  		"DetailCustomizations",
  	}
  );

  if (Target.IsInPlatformGroup(UnrealPlatformGroup.Windows))
  {
  	string PlatformName = "Win64";

  	string LibSndFilePath = Target.UEThirdPartyBinariesDirectory + "libsndfile/";
  	LibSndFilePath += PlatformName;


  	PublicAdditionalLibraries.Add(LibSndFilePath + "/libsndfile-1.lib");
  	PublicDelayLoadDLLs.Add("libsndfile-1.dll");
  	PublicIncludePathModuleNames.Add("UELibSampleRate");

  	RuntimeDependencies.Add("$(EngineDir)/Binaries/ThirdParty/libsndfile/" + PlatformName + "/libsndfile-1.dll");

  	PublicDefinitions.Add("WITH_SNDFILE_IO=1");
  }
  else
  {
  	PublicDefinitions.Add("WITH_SNDFILE_IO=0");
  }

  if (Target.bBuildEditor)
  {
  	PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "UnrealEd", "AssetRegistry",
  		"ApplicationCore",
  		"AudioMixer",
  		"SignalProcessing",
  		"InputCore",
  		"EditorFramework",
  		"Slate",
  		"SlateCore",

  		"RenderCore",
  		"LevelEditor",
  		"Landscape",
  		"PropertyEditor",
  		"DetailCustomizations",
  		"ClassViewer",
  		"GraphEditor",

  		"EditorSubsystem",
  		"GameProjectGeneration",
  		"ToolMenus",
  		"UMG",
  		"DeveloperSettings",
  		"UMGEditor",
  		"AudioExtensions",
  		"AudioLinkEngine"});

  	DynamicallyLoadedModuleNames.AddRange(
  	new string[] {
  		"AssetTools", "ContentBrowser"
  	});
  }
  else
  {
  	PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "AssetRegistry" });
  }

Thanks for everything in advance

I have resolved it.

Add the module : “AudioEditor”

Thanks everyone

1 Like