[FIXED] Can't compile plugin with Component Visualizers

I’ve been making a standalone plugin and following this tutorial to use Component Visualizers with it: A new, community-hosted Unreal Engine Wiki - Announcements - Unreal Engine Forums

The tutorial is for editor modules but I think most of the code should be the same. Anyway, the plugin was compiling and working ok until I added Component Visualizers to it, now it doesn’ t compile and give me this error:

2>C:\Program Files\Epic Games\4.10\Engine\Source\Editor\UnrealEd\Public\ComponentVisualizer.h(38): error C2061: syntax error: identifier ‘FLevelEditorViewportClient’
2>C:\Program Files\Epic Games\4.10\Engine\Source\Editor\UnrealEd\Public\ComponentVisualizer.h(42): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
2>C:\Program Files\Epic Games\4.10\Engine\Source\Editor\UnrealEd\Public\ComponentVisualizer.h(42): error C2143: syntax error: missing ‘,’ before ‘
2>C:\Program Files\Epic Games\4.10\Engine\Source\Editor\UnrealEd\Public\ComponentVisualizer.h(44): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
2>C:\Program Files\Epic Games\4.10\Engine\Source\Editor\UnrealEd\Public\ComponentVisualizer.h(44): error C2143: syntax error: missing ‘,’ before '

2>C:\Program Files\Epic Games\4.10\Engine\Source\Editor\UnrealEd\Public\ComponentVisualizer.h(46): error C2061: syntax error: identifier ‘FEditorViewportClient’
2>C:\Program Files\Epic Games\4.10\Engine\Source\Editor\UnrealEd\Public\ComponentVisualizer.h(48): error C2061: syntax error: identifier ‘FEditorViewportClient’

Those are engine classes and I’m sure there’s nothing wrong with them, looking into my own classes I found nothing wrong in them either so I’m thinking that I should be loading some module that I’m missing. Here’s my Build.cs file:

        PublicDependencyModuleNames.AddRange(
                new string[] {
                    "Engine",
                    "UnrealEd",
                    "InputCore",
                    "Core",
                    "EditorStyle",
                    "CoreUObject",
                    "Landscape",
                    "ComponentVisualizers"
                }
            );

        PrivateDependencyModuleNames.AddRange(
                new string[] {
                    "Engine",
                    "UnrealEd",
                    "InputCore",
                    "Core",
                    "EditorStyle",
                    "CoreUObject",
                    "Landscape",
                    "ComponentVisualizers"
                }
            );

Just threw every module I could think of in there and it’s still giving me that error. Please help. :confused:

Thanks in advance.

FIXED IT

I had to include “UnrealEd.h” to my code and the CoreUObject module to the Build.cs file. Everything seems to be working now.

Thanks for the help.

Can you post the contents of the file that includes ComponentVisualizer.h?

From the looks of it, your ComponentVisualizer has something that’s not included:

error C2061: syntax error: identifier 'FEditorViewportClient' 2>C:\Program Files\Epic Games\4.10\Engine\Source\Editor\UnrealEd\Public\ComponentVisualizer.h(48): error C2061: syntax error: identifier 'FEditorViewportClient'

Maybe you need to look at the generated file?

I can but ComponentVisualizer.h is a file from the engine so it shouldn’t have any problems.

What generated file you’re talking about?

Improper includes can make the error appear to come from other files.

Ok.

#pragma once

#include "ComponentVisualizer.h"
#include "AutoUpdateSplineComponent.h"


/**Base class for clickable targeting editing proxies*/
struct HTargetingVisProxy : public HComponentVisProxy
{
	DECLARE_HIT_PROXY();

	HTargetingVisProxy(const UActorComponent* InComponent)
		: HComponentVisProxy(InComponent, HPP_Wireframe)
	{}
};

/**Proxy for target*/
struct HTargetProxy : public HTargetingVisProxy
{
	DECLARE_HIT_PROXY();

	HTargetProxy(const UActorComponent* InComponent, int32 InTargetIndex)
		: HTargetingVisProxy(InComponent)
		, TargetIndex(InTargetIndex)
	{}

	int32 TargetIndex;
};

class FSplineVisualizer : public FComponentVisualizer
{
public:
	FSplineVisualizer();
	virtual ~FSplineVisualizer();

	virtual void DrawVisualization(const UActorComponent* Component, const FSceneView* View, FPrimitiveDrawInterface* PDI) override;
	
};