3
\$\begingroup\$

I'm following this tutorial on Udemy about learning the basics of Unreal Engine as I start up my CS degree, and I've reached a problem where CoreMinimal.h cannot be found.

This solution was proposed in the Q&A community, however I still could not quite understand it! I'm still learning and would love some help ;)

Here is my code!

// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "GameFramework/Pawn.h"
#include "ShipController.generated.h"

UCLASS()
class SPACESHOOTER_API AShipController : public APawn
{
    GENERATED_BODY()

public:
    // Sets default values for this pawn's properties
    AShipController();

protected:
    // Called when the game starts or when spawned
    virtual void BeginPlay() override;

public: 
    // Called every frame
    virtual void Tick(float DeltaTime) override;

    // Called to bind functionality to input
    virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;
};
\$\endgroup\$

2 Answers 2

4
\$\begingroup\$

Add your engine's Public path to your compiler include path, so that the IDE knows where to find UE header files.

Where did you install the engine? Ex:

E:\Program Files\Epic Games\UE_4.26\

Then (assuming you're using Visual Studio Code, as recommended in the Udemy tutorial) go to: View / Command Palette / "C/C++: Edit Configurations(UI)"

Scroll down to "Include path" and, if missing, add your UE Public folder, ex: E:\Program Files\Epic Games\UE_4.26\Engine\Source\Runtime\Core\Public

Intellisense should now know where to find CoreMinimal.h

You may have to close and re-open your .cpp file to trigger the modified Intellisense path.

Also note that as of this posting 5/6/2021 Intellisense will continue to have difficulty loading CoreMinimal.h because of a separate and unrelated problem relating to macro expansion. You may see:

cannot open source file "UBT_COMPILED_PLATFORM/UBT_COMPILED_PLATFORMPlatformCompilerPreSetup.h" (dependency of "CoreMinimal.h")

So while CoreMinimal.h will still appear red-underlined, the reason is different now. That's progress!

\$\endgroup\$
1
  • \$\begingroup\$ And if you're in normal Visual Studio, rather than VS Code, you can get to the Include settings by right-clicking the Project within the Solution (NOT the top-level Solution) and going to Properties. \$\endgroup\$
    – Luke
    Commented Feb 13, 2023 at 0:54
1
\$\begingroup\$

Got the same problem a few days back. This is most likely because of visual studio acting up. The normal solution is to replace CoreMinimal.h with Engine.h or EngineMinimal.h with severely increased compile time.

The given solution of the community is to ONLY INCLUDE WHAT YOU USE(IWYU). Meaning that you go to the unreal documentation, find your desired component and include ONLY that component as a header in your files.

What worked for me was going to project folder and search and delete the .suo files in that project(These files can be hidden, so you should check the show hidden files settings from the control panel). Open the project and you should most likely see it working.

If this doesn't work, you can probably ignore it. As long as you can compile and build your project, it doesn't matter whether or not you are getting autocomplete suggestions. Although it is annoying, the problem goes away after sometime, like mine did. Good Luck.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .