Hi so i have my projectname.h header file , and in that file i have included three other header file.
in one of those header file i have a struct(USTRUCT) defined.
I am including my projectname.h header file in my custom playercontroller header file.
and when i am trying to declare an array of that struct type in my playercontroller header file, i get compile error like this : Unrecognized type ‘FInventoryItem’ - type must be a UCLASS, USTRUCT or UENUM
so it actually seems even though i am including projectname.h header file in all of my header file, it is not including the other header file properly
so my projectname.h file contains this —
// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
// lastsurvivorsonline.h
#pragma once
//#ifndef _CORE_H_
//#define _CORE_H_
//#include "Core.h"
//#endif // !_CORE_H_
//#ifndef _ENGINE_H_
//#define _ENGINE_H_
//#include "Engine.h"
//#endif // !_ENGINE_H_
//#ifndef _GMGAMEPLAY_H_
//#define _GMGAMEPLAY_H_
//#include "GMGamePlay.h"
//#endif // !_GMGAMEPLAY_H_
//#ifndef _PCGAMEPLAY_H_
//#define _PCGAMEPLAY_H_
//#include "PCGamePlay.h"
//#endif // !_PCGAMEPLAY_H_
//#ifndef _LASTSURVIVORSONLINECHARACTER_H_
//#define _LASTSURVIVORSONLINECHARACTER_H_
//#include "lastsurvivorsonlineCharacter.h"
//#endif // !_LASTSURVIVORSONLINECHARACTER_H_
//#ifndef _INTERACTABLE_H_
//#define _INTERACTABLE_H_
#include "Interactable.h"
//#endif // !_INTERACTABLE_H_
//#ifndef _PICKUP_H_
//#define _PICKUP_H_
#include "Pickup.h"
//#endif // !_PICKUP_H_
//#ifndef _INVENTORYSTRUCTURE_H_
//#define _INVENTORYSTRUCTURE_H_
#include "InventoryStructures.h"
//#endif // !_INVENTORYSTRUCTURE_H_
#ifndef COLLISSION_INTERACTABLE
#define COLLISSION_INTERACTABLE ECC_GameTraceChannel1;
#endif // !COLLISSION_INTERACTABLE
my InventorySturecture.h header file(which contains the structs) contains this
//InventoryStructure.h
#pragma once
#define _INVENTORYSTRUCTURE_H_
#include "Engine/DataTable.h"
#include "lastsurvivorsonline.h"
#include "InventoryStructures.generated.h"
USTRUCT(BlueprintType)
struct FCraftingInfo :public FTableRowBase
{
GENERATED_USTRUCT_BODY()
public:
UPROPERTY(EditAnyWhere, BlueprintReadWrite)
FString ComponentID;
UPROPERTY(EditAnyWhere, BlueprintReadWrite)
FString ProductID;
UPROPERTY(EditAnyWhere, BlueprintReadWrite)
int32 CraftCount;
UPROPERTY(EditAnyWhere, BlueprintReadWrite)
bool bDestroyItemA;
UPROPERTY(EditAnyWhere, BlueprintReadWrite)
bool bDestroyItemB;
};
USTRUCT(BlueprintType)
struct FInventoryItem :public FTableRowBase
{
GENERATED_USTRUCT_BODY()
public:
FInventoryItem()
{
Name = FText::FromString("Item");
Action = FText::FromString("Use");
Description = FText::FromString("Please Enter a Description For This Item");
Value = 10;
Health = MaxHealth;
}
FInventoryItem(const FInventoryItem& Item)
{
ItemId = Item.ItemId;
ItemPickup = Item.ItemPickup;
Name = Item.Name;
Action = Item.Action;
Value = Item.Value;
Count = Item.Count;
MaxStackSize = Item.MaxStackSize;
Thumbnail = Item.Thumbnail;
Description = Item.Description;
CraftCombinations = Item.CraftCombinations;
bStackable = Item.bStackable;
bCanBeUsed = Item.bCanBeUsed;
Health = Item.Health;
MaxHealth = Item.MaxHealth;
UseDamageTable = Item.UseDamageTable;
bSingleUse = Item.bSingleUse;
}
UPROPERTY(EditAnyWhere, BlueprintReadWrite)
FString ItemId;
UPROPERTY(EditAnyWhere, BlueprintReadWrite)
TSubclassOf<class APickup> ItemPickup;
UPROPERTY(EditAnyWhere, BlueprintReadWrite)
FText Name;
UPROPERTY(EditAnyWhere, BlueprintReadWrite)
FText Action;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FName UseText;
UPROPERTY(EditAnyWhere, BlueprintReadWrite)
int32 Value;
UPROPERTY(EditAnyWhere, BlueprintReadWrite)
int32 Count;
UPROPERTY(EditAnyWhere, BlueprintReadWrite)
int32 MaxStackSize;
UPROPERTY(EditAnywhere,BlueprintReadWrite)
float Health;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
float MaxHealth;
UPROPERTY(EditAnyWhere, BlueprintReadWrite)
UTexture2D* Thumbnail;
UPROPERTY(EditAnyWhere, BlueprintReadWrite)
FText Description;
UPROPERTY(EditAnyWhere, BlueprintReadWrite)
TArray<FCraftingInfo> CraftCombinations;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
TMap<FString, float> UseDamageTable;
UPROPERTY(EditAnyWhere, BlueprintReadWrite)
bool bStackable;
UPROPERTY(EditAnyWhere, BlueprintReadWrite)
bool bSingleUse;
UPROPERTY(EditAnyWhere, BlueprintReadWrite)
bool bCanBeUsed;
bool operator==(const FInventoryItem& Item)const
{
if (ItemId == Item.ItemId)
{
return true;
}
else
{
return false;
}
}
};
and my player controller PCGamePlay.h file contains this
// Fill out your copyright notice in the Description page of Project Settings.
//PCGamePlay.h
#pragma once
#define PCGAMEPLAY_H
#include "CoreMinimal.h"
#include "GameFramework/PlayerController.h"
#include "lastsurvivorsonline.h"
#include "PCGamePlay.generated.h"
/**
*
*/
UCLASS()
class LASTSURVIVORSONLINE_API APCGamePlay : public APlayerController
{
struct FinventoryItem;
GENERATED_BODY()
public:
UPROPERTY(BlueprintReadWrite,VisibleAnywhere)
class AInteractable* CurrentInteractable; // Current Interactable or pick up object
UPROPERTY(BlueprintReadWrite,VisibleAnywhere)
TArray<FInventoryItem> Inventory; // here i am getting the error at build time - [PlayerControllers/PCGamePlay.h(28): error : Unrecognized type 'FInventoryItem' - type must be a UCLASS, USTRUCT or UENUM]
UFUNCTION(BlueprintCallable, Category = "Utils")
void AddItemToInventoryByID(FName itemID);
UFUNCTION(BlueprintCallable, Category = "Utils")
void AddItemToInventory(APickup* pickup);
UFUNCTION(BlueprintCallable, Category = "Utils")
void CraftItem(FInventoryItem ItemA, FInventoryItem ItemB, APCGamePlay* controller);
UFUNCTION(BlueprintImplementableEvent)
void ReloadInventory();
void Interact();
protected:
virtual void SetupInputComponent() override;
};
please help…
also i have known from this link : [link text][1]
that i can show all the included header file but i am unable to get this c/c++ option on my project settings.am i mising something.please i need help i am stuck here.
Thank you in advance.