Why do i have to include every single class i want to use.
Hi after porting a blueprint project to a c++ project i ran into some problems. For some reason ue4 dosent know what UGameplayStatics is or what components are. I have to include all of that by hand wich i didnt have todo before in other 4.16 c++ projects. I am also using visual assist and then i auto include the classes it dosent recognize the file path (Something that worked in other projects)
asked Jul 08 '17 at 06:23 PM in C++ Programming
It sounds like you might be missing #include "Core.h" or "CoreMinimal.h" in your .h in your Source root directory.
The Core files have a big list of all the common includes so you don't have to include everything manually. The .h file is your precompiled header file, which all files in your project should include by default.
So, if you pop the core include in your PCH header file then you shouldn't encounter this issue any more.
^^ UPDATE: EngineMinimal.h - this is what you need - at least for UGameplayStatics.
Thats why you include what you need and the reasson why is also stated there aswell as how you go back to the old way of doing it. IWYU is the Standard since 4.15 or 4.16 not sure. I recommand addating to it for the benefits of Compile times etc.
answered Jul 08 '17 at 08:42 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here