I am new to UE and VSCode and I have been trying to get some experience in game development. I started going through the Battery Collector tutorial (C++ Battery Collector: Adding Variables & Functions | 04 | v4.9 Tutorial Series | Unreal Engine - YouTube ) as I have a coding background and would like to get into the API and general C++ implementation.
I am having issue with VSCode. Some of the included header files added by Unreal when I created the class are showing an error from Intellisense: “cannot open source file “*.h””,
where *=any Unreal Class header
I am more than happy to provide any other information or get involved however is best. This doesn’t stop me from compiling but I would like to understand what is going on, any help or insight would be great.
Thank you!
Try this:
README.md
# Visual Studio Code C/C++ Propeties files for UE 4.20
Version 4.20 of Unreal Engine does not generate includes for `*.generated.h` files. To fix this, you must modify your `c_cpp_properties.json`.
1. Create an environment variables called `UNREAL_ENGINE` pointing to the Unreal Engine folder (`UE_4.20` for example) with no trailing backslash.
1. Replace your `c_cpp_propeties.json` with the one below.
## Other intellisense issues
Visual Studio Code seems to not understand Include-What-You-Use style headers. To fix this, replace `#include "CoreMinimal.h"` and any other Unreal system includes with `#include "Engine.h"`. This should fix Intellisense errors, at the cost of some initial compile time.
c_cpp_properties.json
{
"configurations": [
{
"name": "UnrealEngine",
"includePath": [
"${env:UNREAL_ENGINE}/Engine/Source",
"${workspaceFolder}/Source/${workspaceFolderBasename}",
"${workspaceFolder}/Intermediate/Build/Win64/UE4Editor/Inc/${workspaceFolderBasename}",
"${env:UNREAL_ENGINE}/Engine/Intermediate/Build/Win64/UE4Editor/Inc/AIModule",
"${env:UNREAL_ENGINE}/Engine/Intermediate/Build/Win64/UE4Editor/Inc/AITestSuite",
This file has been truncated. show original
You’ll have to tweak some of the hard-coded paths for Linux.