[UE4] Intellisense Errors and USTRUCT

The Intellisense feature of Visual Studio, while useful is quite different from the compiler and on occassion produces false positive errors. According to the document about Setting Up Visual Studio for UE4, this can happen for few possible reason

  • The IntelliSense compiler (EDG) is more strict than the MSVC compiler.

  • Some #defines are setup differently for IntelliSense than when building normally.

  • C++ compiled by IntelliSense is always treated as 32-bit.

However, there is also the case where the Intellisense is just plain wrong. USTRUCT() structures are just such a case. You will find that Intellisense complains about definitions with the structures defined as USTRUCT.

 

This may not be a big deal, except for the fact these fales positives makes it difficult to spot actual errors and I like to see a clean workspace with no errors (not even false positives). Fortunately, there is a workaround. You can include the USTRUCT definitions only if it is not being compiled by Intellisense.

 

Fortunately, it is just the GENERATED_USTRUCT_BODY() line that is the culprit. To get these errors to go away, instead of that single line, use the following


	#ifndef __INTELLISENSE__ /* Eliminating erroneous Intellisense Squigglies */ 
	GENERATED_USTRUCT_BODY()
	#endif

and that’ll make those pesky squiggly lines to disappear and give you a nice clean workspace 😀

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s