#include errors detected in VS Studio Code

Hi, @DanM

I am doing the Unreal Engine C++ Developer: Learn C++ and Make Video Games Course. During lecture 89, I have to setup a new Unreal Engine project: Building_Escape.

After setting up the VS code through UE, my VS code seemed fine.
Then I added a component to the sphere, as per the lessons instructions. This caused the new WorldPosition.h and WorldPosition.cpp as well as the other source code to give errors.
I am getting #include errors. See image below:

I have searched online for solutions, however they do not seem to apply:
**1. Solution 1 **
Copy in the define code from UE2.4 into the c_cpp_properties.json of VS code.
Solution 1 response
My .json does not contain the define section to paste in the indicated code.

**2. Solution 2 **
Ensure Unreal Engine is using VS Studio Code as compiler of preference.
**2. Solution 2 response **
I verified that it does. (I also refreshed it).

3. Solution 3
Use Windows in order to make use of the VS Studio Code intellisense and .json setup.
3. Solution 3
I am using Windows 10.

Unreal doesn’t automatically refresh the compileCommands when adding a new class. You can do that manually by doing File > Refresh VS Code project within Unreal.

2 Likes

Hi DanM,

Firstly, thank you for your quick response.
I have refreshed VS Studio Code via unreal multiple times.
When I do this, all the errors disappear for a few seconds and then just return with the same #include error and red squiggles everywhere.

Any thoughts?
Kind Regards
Tiaan Adlem

Have you tried this extension?

https://gist.github.com/boocs/f63a4878156295b6e854cac68672f305#Installation

Hi @DanM,

Unfortunately it does not seem to fix my problem.
I downloaded, installed and enabled the extension as per the instructions.
I then restarted VS code, but the errors are still there.
I then closed VS code again. Located my Building_Escape.uproject and selected Generate Visual Studio Project Files. I also refreshed my visual studio project through unreal engine, unfortunately nothing has worked.

Kind Regards
Tiaan Adlem

And what version of the C/C++ extension are you using?

Hi @DanM,

Thanks for sticking with me trying to solve this.
I am using version 1.3.0.

Kind Regards
Tiaan Adlem

Could you try down grading to the latest stable release? 1.2.2?
You can do that via this menu

image

Hi @DanM,

That was it! Thanks so much for helping me, truly appreciate it :smile:

Kind Regards
Tiaan Adlem

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms