UCLASS() error

Hello.
I receive this UCLASS error : " this declaration has no storage class or type specifier " whenever UCLASS isnt exactly on line 7,so therefore I can’t write anything above it.I’m receving this error even in the template projects.

I tried reinstalling both Visual studio and the engine but that didn’t fix it.Does anyone know what might be causing this problem?

Hey Sheed-

Could you post the errors Visual Studio provide when trying to compile? After creating a new class based on Actor, the default setup has the UCLASS macro on line 8. Adding blank lines above the UCLASS marco did not affect the build process either.

Cheers

Hmm,this is very odd.

When I create a new class based on Actor,for example,like you said and then when I try to add code above the UCLASS macro or just some blank lines, I’m getting these errors in my error list:

1 (2 and 3 are the same) IntelliSense: name followed by ‘::’ must be a class or namespace name;

4 IntelliSense: this declaration has no storage class or type specifier;

5 IntelliSense: expected a ‘;’

The interesting part is I successfully build my project even with those errors,and when I close Visual Studio and open it again,the errors are gone.

If it compiles correctly, even when IntelliSense is complaining, do this:

Change to DevelopmentEditor configuration, compile; Change to DevelopmentGame configuration, compile. This gets IntelliSense to recompile and rescan headers and everything works fine again.

This often happens when you alter the lines in your .h code, above the declaration of UCLASS but it can affect other types too.

This removes the errors,thanks.

Unfortunately,I have to do this everytime I make changes above the UCLASS macro :confused:

Yepp but repeated compilations are relatively fast, after the big build… :slight_smile:

I just have to say this, “IntelliSense” is far closer to “IntelliStupid”

Please Please Please, consider a Feature Request of support Eclipse…

I don’t know that for a fact, but I always thought this problem is only related to the headers themselves, and not VS.

I;ve did it once and it worked, but right now after changing again, repeating same process it do not work.

VS Intellisense works just fine for other languages/engines.

There is no DevelopmentGame configuration by default, how did you get that?

Just switch between whatever you are using. Eg ‘DevelopmentEditor’ and ‘Development’… or ‘DevelopmentClient’…

Forces intellisense to reinit its dependencies

With QtCreator swapping Build configuration also does the trick!

Go to build → configuration Manager → then change the active solution platform from Win64 to Win32 or vice verse

to solve the issue with UCLASS() intellisense error when adding/removing lines in the header file I have to do two steps.

  1. UE editor: compile
  2. VS: switch to for example “deveopment” or any other config, and then back to “development editor”.

This is with UE 4.16.1 and VS2017. It’s the only solution that has worked for me…

Thanks! Changing between “Development Editor” and “Development” solved the false positive errors for me!

is it because of new version of unreal (4.15) , IWYU Conventions makes every .h file can’t include other thing ,and we should keep .h file default #include structure ?

your unreal and vs version is as the same of mine