UE4 报错 missing type specifier - int assumed

没有提示的错误,但是编译时就出现:missing type specifier - int assumed

我出现的原因是在使用MergeActor时,

#include "Editor/MergeActors/Public/IMergeActorsModule.h"

当在其他文档引用时,build的时候,就提示 MergeActorsModule.h文件中很多错误,就包括missing type specifier - int assumed。

解决办法:

MergeActors是一个单独的Module,在其他Module中使用时,添加头文件后,要在Build.cs文件中添加相应Module,才会正常,如我在ContentBrowser.Build.cs中添加,如下:

// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.

using UnrealBuildTool;

public class ContentBrowser : ModuleRules
{
	public ContentBrowser(ReadOnlyTargetRules Target) : base(Target)
	{
		PrivateIncludePathModuleNames.AddRange(
			new string[] {
				"AssetRegistry",
				"AssetTools",
				"CollectionManager",
				"EditorWidgets",
				"GameProjectGeneration",
                "MainFrame",
				"PackagesDialog",
				"SourceControl",
				"SourceControlWindows",
                "MergeActors"
            }
		);

		PrivateDependencyModuleNames.AddRange(
			new string[] {
                "AppFramework",
				"Core",
				"CoreUObject",
				"ApplicationCore",
                "InputCore",
				"Engine",
				"Slate",
				"SlateCore",
                "EditorStyle",
				"SourceControl",
				"SourceControlWindows",
				"WorkspaceMenuStructure",
				"UnrealEd",
				"EditorWidgets",
				"Projects",
				"AddContentDialog",
				"DesktopPlatform",
				"XmlParser",
			}
		);

		DynamicallyLoadedModuleNames.AddRange(
			new string[] {
				"PropertyEditor",
				"PackagesDialog",
				"AssetRegistry",
				"AssetTools",
				"CollectionManager",
				"GameProjectGeneration",
                "MainFrame",
                "MergeActors"
            }
		);
		
		PublicIncludePathModuleNames.AddRange(
            new string[] {                
                "IntroTutorials"
            }
        );
	}
}

之后就正常了。

你可能感兴趣的:(UE4)