UE4 报错 missing type specifier - int assumed

本文介绍了一个在使用MergeActors模块时遇到的编译错误:missingtypespecifier-intassumed,并提供了解决方案。通过在ContentBrowser.Build.cs文件中正确地添加MergeActors模块依赖,可以消除该错误。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

没有提示的错误,但是编译时就出现: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"
            }
        );
	}
}

之后就正常了。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值