Error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

I am trying to define this ustruct in C++, following this tutorial.

#pragma once
 
#include "CoreMinimal.h"
#include "Engine/DataAsset.h"
#include "MyInputConfig.generated.h"
 
class UInputAction;
 
 
USTRUCT(BlueprintType)
struct FTaggedInputAction
{
	GENERATED_BODY()
 
public:
 
	UPROPERTY(EditDefaultsOnly)
	const UInputAction* InputAction = nullptr;
 
};

But I keep getting the following errors:

Error C4430 : missing type specifier - int assumed. Note: C++ does not support default-int
Error C2146 : syntax error: missing ';' before identifier 'UClass'
Error C2065 : 'Z_Construct_UClass_UInputAction_NoRegister': undeclared identifier

The issue lies whit UInputAction, but I don’t understand why. Any idea what the problem is?

I had to add “EnhancedInput” to my PublicDependencyModuleNames, although I don’t understand why since we are forward declaring this class

I don’t understand why since we are forward declaring this class

Other than declaring, the class you using should be defined somewhere in your project. That’s what is *DependencyModuleNames for - without it your project is build without using this part of sources.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.