0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

- type must be a UCLASS, USTRUCT or UENUMで検索した人へ

Posted at

#概要
TArrayで上記のエラーが出てコンパイルが通らなかった場合の
正しい書き方が記事が日本語で出てこなかった上に英語ですら上位に出てこなかったので書く。

結論から言うと同じヘッダーファイルでFMyStructを宣言している場合、
TArrayと書きたい箇所より前にFMyStructを宣言しておく必要がある。

C++がきちんと分かっている人からすると当たり前すぎることっぽいので文書になってなさそう。

#要はこういうこと
###こう書くとエラーになる

MystructA.h
STRUCT()
struct FMyStructA
{
	GENERATED_USTRUCT_BODY()
	TArray<FMyStructB> Structs;

};

USTRUCT()
struct FMyStructB 
{
	GENERATED_BODY()
};

###こう書けば良い

MyStructA.h
USTRUCT()
struct FMyStructB 
{
	GENERATED_BODY()
};

STRUCT()
struct FMyStructA
{
	GENERATED_USTRUCT_BODY()
	TArray<FMyStructB> Structs;

};
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?