Issues with Visual Studio and Unreal

Has anyone else had issues using visual studio and unreal?

  1. The code in the examples seems to be outdated
    a. For example, PCIP instead of FObjectInitializer
  2. The generated headers consistently give me issues with compilation whether I add new classes with the wizard or manually and move them from Intermediate. Even generating the visual studio files via the .uproject file gives me no relief.
  3. General lack of clarity.

I’m a software developer with 3 years of work and I’ve never come across an API/setup that gave me this much trouble. Does anyone have some resources I can read through that show a clear usage of the API? Maybe clear steps to add new code to the project without getting any issues with the .generated.h files? I would like to use Unreal to learn game programming (as most of my work focuses on backend/desktop/web development rather than interactive applications), but I feel bogged down in errors and lack of clarity.

Any help appreciated.

What version of the engine are you running?

What are you doing?

@WCode 4.6.1
@Cmartel If you add .cpp or .h files through the normal visual studio route (add -> new item) they are put into myproject/intermediate. If you want to generate header files for them via UE4 you have move them from intermediate to the source folder and then use the uproject file to generate headers. If you add the files through the wizard instead, the header files should already be generated. The problem is that neither way generates the header files so I end up with compilation errors.

Oh, phew, your initial post made it sound like you were moving the generated files out of intermediate.

Yeah, Visual Studio doesn’t play well with UE4’s way of separating project files from source files. I avoid using either wizards and simply create .h/.cpp files where I need them, then regenerate project files.

It’s entirely normal that the .generated header files aren’t created right away. They’re created automatically by the unreal header tool as a special preprocessing pass. If you’re getting squigglies saying the header doesn’t exist before the first compile, that’s fine. If the compile is failing outright due to missing .generated files, then either the header has parsing errors and is not created at all, or something is really wrong and the UHT isn’t running at all.

Alright thanks. I will experiment some more tonight. What if I get squiggles on the preprocessor macros specific to unreal? Like UCLASS and generated_body?

Squiggles are just IntelliSense errors, which are sometimes inaccurate and can generally be ignored in those cases. For instance, GENERATED_USTRUCT_BODY() always gives me squiggles but not GENERATED_UCLASS_BODY() for some reason. But the game compiles just fine. It’s annoying but you get used to recognizing which errors mean something or not.

I used to think this as well, but when you add new code to the project, it actually asks you for the folder path you want to drop the file in. I completely overlooked this. By default, it goes to the intermediate folder. You can change this and it’ll remember the last folder you inserted code into.