VS Code: Code shows errors in IDE, yet builds are successful

I have issues, reminiscent of IDE errors from Visual Studio, were the IDE is putting out false errors, which lead to no or limited intellisense. I have rebuilt the project a few times, re-generated the project, tried to run with Editor open, and closed.

The project does build with no errors, so these are IDE issues, but I do’t know if they are caused by unreal setup or VS Code itself.

Also note: This is in a plugin, and it doesn’t seem to understand the class SIMPLESOCKETS_API part… there are still errors if I remove it, but it stops saying that SIMPLESOCKETS_API is a class.

Environment: Windows 10, Just clicked Update on VSCode (1.18.1?), 4.18 Unreal.


in the header file, the : when hovered says ‘expected a “;”’

in the cpp file: On USocketComponent:: it says “name followed by ‘::’ must be a class or namespace name” also same error on Super:: and any variable error reads “identifier ‘variablename’ is undefined”

What does it say as “error” when you hover your mouse over the red underlined words?

It’s not an error but just an MSVC inaccuracy. These underlines usually disappear when MSVC finishes to build a program database.

so how long should it take to build a program database? its been a very long time and I still get these errors…

It is in most cases for me a missing include.
But in most cases I don’t want that.
The code is building, more includes mean longer build time.
So the IDE is not happy. So what? Who cares.

So what? Who cares.

Really? It’s kind of a big deal. This throws off all useful linting from vscode because it’s hung on this one error.

Here’s an example of why this could be a headache for someone. There’s a simple typo that would normally be caught by the linter, but now it isn’t.

Same problem here. New project, all I’ve done here is create an Actor C++ file. My environment is macOS 10.13.1, UE 4.18.

Same issue over here (Linux, UE 4.18.2) - Plonking "C_Cpp.intelliSenseEngine": "Tag Parser", in your VSCode config seems to help (In terms of better tag completion), but then you’re left with zero error checking :confused:

I have just continued working on my project while I hope this gets looked at eventually… I just have to build and wait for compile errors to show any typos, etc… also more research is required to remember the methods and properties that intellisense would simply remind of on a regular basis. Fairly annoying… I will try @CraftedCart’s option and see if it makes it any better tho.

include “Engine.h” !!!

in your .h file.

source:Unreal Engine 4 —— 常见Tips_谁允许你直视本大叔的?-CSDN博客



like this

I have added this, and, yes the errors go away, but now I need to know why this happens… before I can say this is the definitive answer.

i dont know more.
syntax error caused by “InputCoreTypes.h”

I fixed it by updating my c_cpp_properties.json. The “defines” field can take values in the form of “define=value”, so in my case I was working with a FPSGAME_API causing the issue and I made my defines:

            "defines": [

You can probably do something similar with

As already said, the problem is solved by fixing the file c_cpp_properties.json. I just copied the definitions from the Visual Studio 2017 project and it worked.

The code for c_cpp_properties.json file (works for UE 4.18 and Windows 10)
But you need to change the line: “ORIGINAL_FILE_NAME=‘UE4Editor-ProjectName.dll’”

"defines": [

This is the best I’ve seen so far. But yeah, still no error checking, so it’s not reason enough for me to switch :confused:

I mean, yeah including “Engine.h” in the code might solve this, but we really should not have to be doing this. There’s a reason UE4 stopped that practice.

While I agree that the c_cpp_properties.json file is likely the culprit, your solution did not work for me. I may have just copied something wrong, or my project may required different defines than yours, however.

Could you let us know where you found this list? I looked through the .vs files and my VS2017 project and couldn’t find any list of defines like this.

In Visual Studio 2017: Project > Properties > Nmake > Preprocessor Definition > Edit
(And check the Include Search Path > Edit)