C++ member inaccessible

I am trying to follow the tanks vs zombies c++ live streams by unreal and I noticed that I am getting red lines on some of the member functions i am using (ie : TargetArmLength , CameraLagSpeed

) .I am able to build the project via both visual studio and unreal editor , still if i open the errors list in vs i get a lot of errors. I just want to know if this is normal in C++ (Unreal development) and if it is possible to remove these errors and getting these member functions to autocomplete ( i m guessing they do not autocomplete because they are inaccessible for some reason … maybe they are private ?)
Thanks a lot in advance

This is currently a problem with intellisense in Visual Studio using 4.20. Any class that uses the GENERATED_CLASS_BODY macro seems to be affected.

The difference between GENERATED_UCLASS_BODY and GENERATED_BODY is that the former sets accessibility to public afterwards, whereas the latter sets it to be private. Visual Studio 2017, even with Visual Assist installed, seems to miss the reset to public accessibility afterwards and reports accessing those members or functions as an error when in actuality they are available (as noted by the successful build).

Thanks for the answer , so the only solution for the moment is to wait for a fix by visual studio?
I wonder if i change engine version to 4.19 would this problem be fixed ?

I’m honestly not sure what “broke” this between 4.19 and 4.20, but at least with USpringArmComponent I do not get error squiggles for TargetArmLength or the other properties you’re also accessing there (in 4.19).

As per the comment above by @anonymous_user_36c67d42, this is not an issue caused by intellisense, but rather UBT is causing this by not including generated header files when projects are generated. I didn’t notice this issue in 4.21’s binary release but in a fresh source build for 4.21 it is an issue. You can fix this yourself by manually adding the location of the generated header files to your project’s include search paths. Which paths you will need to add will entirely depend on what modules and plugins you are using. Its a real mess to do but it will play nice with intellisense after you correct this.

I have noticed the same issue, especially regarding the USpringArmComponent.

It’s a false alarm, I was able to compile and get the functionality I desired despite the warning.

USpringArmComponent contains a GENERATED_UCLASS_BODY() in its class definition which is a macro that perhaps is confusing Visual Assist. The macro makes all the initial code right below it Public by default instead of how C++ or GENERATED_BODY() normally is Private.

The only problem is, a whole lot of other classes also use GENERATED_UCLASS_BODY(). Not 100% sure if this issue exists for other classes as well.

Anyone can further comment?