Do this if your Intellisense doesn't work in VS Code after files are created

[EDIT 2021/09/26] I found another way that is far easier. Left the old Fix for documentation.

Hi there,

I ran into a bug when I created the OpenDoor Actor Component and managed to fix it in the process, so I’m sharing it here if anyone needs it too.

After I created the OpenDoor Actor component and after my files appeared on my VS Code, My intellisense showed red stripes on the include items alongside some errors in terminal. No matter what, I couldn’t use anything linked to the intellisense, wich is truely a pain when working with UE4 components.

OpenDoor.h :


Error :

[22/08/2021, 15:25:04] "OpenDoor.cpp" introuvable dans "${workspaceFolder}\.vscode\compileCommands_Default.json". 'includePath' dans c_cpp_properties.json dans le dossier 'Building_Escape' sera utilisé à la place pour ce fichier.
[22/08/2021, 15:25:04] "OpenDoor.cpp" introuvable dans "${workspaceFolder}\.vscode\compileCommands_Default.json". 'includePath' dans c_cpp_properties.json dans le dossier 'Building_Escape' sera utilisé à la place pour ce fichier.

Fix :
It appears that, when Unreal creates files, it also adds some entries in the compileCommands_Default.json located in the .vscode folder. And in this case, it didn’t add entries concerning the OpenDoor Component.

Something you can do and that works everytime is to use Refresh Visual Studio Code Project in File Menu. That will aslo be useful as it won’t be necessary to shutdown Unreal Engine for the next courses when you create C++ Components that don’t appear immediatly on creation (like in ToonTanks section).

Old Fix

All I had to do was to copy the last two entries (added when we creating the WorldPosition component, one for the .h file, and the other for the .cpp file) and rename the last part of it with the right Component Name, like this :

{
		"file": "{your project folder}\\\\Source\\\\Building_Escape\\\\OpenDoor.cpp",
		"command": "cl.exe @\"{your project folder}\\.vscode\\compileCommands_Default\\Building_Escape.182.rsp\"",
		"directory": "C:\\Programmes\\Epic Games\\UE_4.26\\Engine\\Source"
	},
	{
		"file": "{your project folder}\\\\Source\\\\Building_Escape\\\\OpenDoor.h",
		"command": "cl.exe @\"{your project folder}\\.vscode\\compileCommands_Default\\Building_Escape.182.rsp\"",
		"directory": "C:\\Programmes\\Epic Games\\UE_4.26\\Engine\\Source"
	}

Of Course, {your project folder} will be different from mine so don’t forget to change it (just look at the .json’s other entries).

Hope that helps someone.

1 Like

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

Privacy & Terms