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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Unresolved external symbol - accessing Editor Mode static method

Hi,

I'm trying to write an editor plugin that can resimulate all the ProceduralFoliageVolumes in the world context. To do this I'm using the following code, patterned after the implementation of FProceduralFoliageComponentDetails::OnResimulateClicked() in Editor/FoliageEdit/Private/ProceduralFoliageComponentDetails.h:

 for (TActorIterator<AProceduralFoliageVolume> FoliageVolumeItr(World); FoliageVolumeItr; ++FoliageVolumeItr)
 {
     bool bGenerageSucceeded = false;
     
     if (FoliageVolumeItr->ProceduralComponent->FoliageSpawner == nullptr)
     {
         UE_LOG(LogTemp, Warning, TEXT("Unable to resimulate %s: FoliageSpawner is nullptr"), *FoliageVolumeItr->GetName());
         continue;
     }
 
     bGenerateSucceeded = FoliageVolumeItr->ProceduralComponent->GenerateProceduralContent(OutFoliageInstances);
     if (bGenerateSucceeded)
     {
         UE_LOG(LogTemp, Warning, TEXT("GenerateProceduralContent succeeded for %s"), *FoliageVolumeItr->GetName());
         FEdModeFoliage::AddInstances(World, OutFoliageInstances);
     }
 }


However, I keep getting the following error: error LNK2019: unresolved external symbol "public: static void __cdecl FEdModeFoliage::AddInstances(class UWorld *,class TArray const &)" (?AddInstances@FEdModeFoliage@@SAXPEAVUWorld@@AEBV?$TArray@UFDesiredFoliageInstance@@VFDefaultAllocator@@@@@Z) referenced in function "public: void __cdecl USpawnTool::ResimulateAll(void)" (?ResimulateAll@USpawnTool@@QEAAXXZ)

As far as I can tell, AddInstances isn't accessible for some reason, maybe because its header file (Editor/FoliageEdit/Private/FoliageEdMode.h) isn't part of the normal API. Is there a way I can make it accessible? I'd really like to use this function, and I'm not sure I can resimulate any volumes without it.

Here's a list of my includes if they'd be helpful: "Engine.h", "Editor.h", "SlateBasics.h"

"ProceduralFoliageSpawner.h", "ProceduralFoliageVolume.h", "ProceduralFoliageComponent.h", "FoliageType.h", "InstancedFoliage.h"

"Editor/UnrealEd/Public/EditorModes.h", "Editor/UnrealEd/Public/EditorComponents.h", "Editor/UnrealEd/Public/EdMode.h", "Editor/FoliageEdit/Private/FoliageEdMode.h", "Editor/PropertyEditor/Public/IDetailCustomization.h", "Editor/FoliageEdit/Private/ProceduralFoliageComponentDetails.h"

"Editor/UnrealEd/Classes/Builders/EditorBrushBuilder.h", "Editor/UnrealEd/Classes/Builders/CubeBuilder.h"

Product Version: UE 4.11
Tags:
more ▼

asked Jun 16 '16 at 10:20 PM in C++ Programming

avatar image

geoffrey1218
106 6 4 10

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

2 answers: sort voted first

I figured it out. The class I was trying to access was not flagged for export, so I couldn't access from another class it through the API. I had to replace line 193 of FoliageEdMode.h with "class FOLIAGEEDIT_API FEdModeFoliage : public FEdMode" instead of "class FEdModeFoliage : public FEdMode". After that, I just recompiled the engine from source and it worked.

more ▼

answered Jun 17 '16 at 11:57 PM

avatar image

geoffrey1218
106 6 4 10

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

Try adding PrivateDependencyModuleNames.AddRange(new string[] { "FoliageEdit" }); to YourPrjectName.Build.cs file and save it. Then right click on your uproject file and select Generate Visual Studio project files.

more ▼

answered Jun 17 '16 at 06:07 AM

avatar image

ryanjon2040
1.6k 55 43 93

avatar image geoffrey1218 Jun 17 '16 at 03:29 PM

I just tried it, but it still gives me the same error. I had also put "FoliageEdit" into the Private and Public Dependencies in my plugin's Build.cs file earlier, but that didn't fix it either.

(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