Every time I create new C++ class, VSC have problems with all include paths

Hello, every time I create new C++ class, Visual studio have problems with all include paths -

[4/3/2024, 8:38:09 PM] "Tower.cpp" not found in "D:\Unreal Projects\ToonTanks\.vscode\compileCommands_Default.json". 'includePath' from c_cpp_properties.json in folder 'TOONTANKS' will be used for this file instead.

I had this situation with Tank.ccp/.h, Tower.ccp/.h, and few times in previous tutorials I tried rebuilding the project with “ToonTanksEditor Win64 Development Build” and restarting Visual Studio Code - with no luck, only thing that helps me was “Refreshing Visual Studio Project” but that’s kinda problematic to do every time I want to add new class is there anything I can do with it?

For a test I added another C++ class “Test” and it has same problems, I think problem might be that compileCommands_toonTanks.json doesnt, get updated:

[
	{
		"file": "D:\\Unreal Projects\\ToonTanks\\Source\\ToonTanks\\BasePawn.cpp",
		"arguments": [
			"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.37.32822\\bin\\Hostx64\\x64\\cl.exe",
			"@D:\\Unreal Projects\\ToonTanks\\.vscode\\compileCommands_ToonTanks\\ToonTanks.1.rsp"
		],
		"directory": "D:\\EpicGames\\UE_5.3\\Engine\\Source"
	},
	{
		"file": "D:\\Unreal Projects\\ToonTanks\\Source\\ToonTanks\\BasePawn.h",
		"arguments": [
			"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.37.32822\\bin\\Hostx64\\x64\\cl.exe",
			"@D:\\Unreal Projects\\ToonTanks\\.vscode\\compileCommands_ToonTanks\\ToonTanks.1.rsp"
		],
		"directory": "D:\\EpicGames\\UE_5.3\\Engine\\Source"
	},
	{
		"file": "D:\\Unreal Projects\\ToonTanks\\Source\\ToonTanks\\Tank.cpp",
		"arguments": [
			"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.37.32822\\bin\\Hostx64\\x64\\cl.exe",
			"@D:\\Unreal Projects\\ToonTanks\\.vscode\\compileCommands_ToonTanks\\ToonTanks.1.rsp"
		],
		"directory": "D:\\EpicGames\\UE_5.3\\Engine\\Source"
	},
	{
		"file": "D:\\Unreal Projects\\ToonTanks\\Source\\ToonTanks\\Tank.h",
		"arguments": [
			"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.37.32822\\bin\\Hostx64\\x64\\cl.exe",
			"@D:\\Unreal Projects\\ToonTanks\\.vscode\\compileCommands_ToonTanks\\ToonTanks.1.rsp"
		],
		"directory": "D:\\EpicGames\\UE_5.3\\Engine\\Source"
	},
	{
		"file": "D:\\Unreal Projects\\ToonTanks\\Source\\ToonTanks\\ToonTanks.Build.cs",
		"arguments": [
			"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.37.32822\\bin\\Hostx64\\x64\\cl.exe",
			"@D:\\Unreal Projects\\ToonTanks\\.vscode\\compileCommands_ToonTanks\\ToonTanks.1.rsp"
		],
		"directory": "D:\\EpicGames\\UE_5.3\\Engine\\Source"
	},
	{
		"file": "D:\\Unreal Projects\\ToonTanks\\Source\\ToonTanks\\ToonTanks.cpp",
		"arguments": [
			"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.37.32822\\bin\\Hostx64\\x64\\cl.exe",
			"@D:\\Unreal Projects\\ToonTanks\\.vscode\\compileCommands_ToonTanks\\ToonTanks.1.rsp"
		],
		"directory": "D:\\EpicGames\\UE_5.3\\Engine\\Source"
	},
	{
		"file": "D:\\Unreal Projects\\ToonTanks\\Source\\ToonTanks\\ToonTanks.h",
		"arguments": [
			"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.37.32822\\bin\\Hostx64\\x64\\cl.exe",
			"@D:\\Unreal Projects\\ToonTanks\\.vscode\\compileCommands_ToonTanks\\ToonTanks.1.rsp"
		],
		"directory": "D:\\EpicGames\\UE_5.3\\Engine\\Source"
	},
	{
		"file": "D:\\Unreal Projects\\ToonTanks\\Source\\ToonTanks\\Tower.cpp",
		"arguments": [
			"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.37.32822\\bin\\Hostx64\\x64\\cl.exe",
			"@D:\\Unreal Projects\\ToonTanks\\.vscode\\compileCommands_ToonTanks\\ToonTanks.1.rsp"
		],
		"directory": "D:\\EpicGames\\UE_5.3\\Engine\\Source"
	},
	{
		"file": "D:\\Unreal Projects\\ToonTanks\\Source\\ToonTanks\\Tower.h",
		"arguments": [
			"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.37.32822\\bin\\Hostx64\\x64\\cl.exe",
			"@D:\\Unreal Projects\\ToonTanks\\.vscode\\compileCommands_ToonTanks\\ToonTanks.1.rsp"
		],
		"directory": "D:\\EpicGames\\UE_5.3\\Engine\\Source"
	}
]

Oh I almost forget I use Visual Studio Code version 1.87.2 and UE 5.3.2.

I’ve also checked that in UE my editor is set correctly:

And this is outcome of LiveCoding after creating new class:

Manual recompile triggered
---------- Creating patch ----------
Running D:\EpicGames\UE_5.3\Engine\Build\BatchFiles\Build.bat -Target="ToonTanksEditor Win64 Development -Project=""D:/Unreal Projects/ToonTanks/ToonTanks.uproject""" -LiveCoding -LiveCodingModules="D:/EpicGames/UE_5.3/Engine/Intermediate/LiveCodingModules.json" -LiveCodingManifest="D:/EpicGames/UE_5.3/Engine/Intermediate/LiveCoding.json" -WaitMutex -LiveCodingLimit=100
  Using bundled DotNet SDK version: 6.0.302
  Running UnrealBuildTool: dotnet "..\..\Engine\Binaries\DotNET\UnrealBuildTool\UnrealBuildTool.dll" -Target="ToonTanksEditor Win64 Development -Project=""D:/Unreal Projects/ToonTanks/ToonTanks.uproject""" -LiveCoding -LiveCodingModules="D:/EpicGames/UE_5.3/Engine/Intermediate/LiveCodingModules.json" -LiveCodingManifest="D:/EpicGames/UE_5.3/Engine/Intermediate/LiveCoding.json" -WaitMutex -LiveCodingLimit=100
  Log file: C:\Users\igord\AppData\Local\UnrealBuildTool\Log.txt
  Invalidating makefile for ToonTanksEditor (source file added)
  Parsing headers for ToonTanksEditor
    Running Internal UnrealHeaderTool "D:\Unreal Projects\ToonTanks\ToonTanks.uproject" "D:\Unreal Projects\ToonTanks\Intermediate\Build\Win64\ToonTanksEditor\Development\ToonTanksEditor.uhtmanifest" -WarningsAsErrors -installed
  Total of 3 written
  Reflection code generated for ToonTanksEditor in 1.1652633 seconds
  Building ToonTanksEditor...
  Using Visual Studio 2022 14.37.32825 toolchain (C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.37.32822) and Windows 10.0.22621.0 SDK (C:\Program Files (x86)\Windows Kits\10).
  [Upgrade]
  [Upgrade] Using backward-compatible include order. The latest version of UE has changed the order of includes, which may require code changes. The current setting is:
  [Upgrade]     IncludeOrderVersion = EngineIncludeOrderVersion.Unreal5_0
  [Upgrade] Suppress this message by setting 'IncludeOrderVersion = EngineIncludeOrderVersion.Latest;' in ToonTanksEditor.Target.cs.
  [Upgrade] Alternatively you can set this to 'EngineIncludeOrderVersion.Latest' to always use the latest include order. This will potentially cause compile errors when integrating new versions of the engine.
  [Upgrade]
  Determining max actions to execute in parallel (8 physical cores, 16 logical cores)
    Executing up to 8 processes, one per physical core
  ------ Building 3 action(s) started ------
  [1/3] Compile [x64] ToonTanks.init.gen.cpp
  [2/3] Compile [x64] Test2.gen.cpp
  [3/3] Compile [x64] Test2.cpp
  Total time in Parallel executor: 0.61 seconds
  Total execution time: 4.06 seconds
File D:\Unreal Projects\ToonTanks\Intermediate\Build\Win64\x64\UnrealEditor\Development\ToonTanks\Test2.cpp.obj was modified or is new
File D:\Unreal Projects\ToonTanks\Intermediate\Build\Win64\x64\UnrealEditor\Development\ToonTanks\Test2.gen.cpp.obj was modified or is new
File D:\Unreal Projects\ToonTanks\Intermediate\Build\Win64\x64\UnrealEditor\Development\ToonTanks\ToonTanks.init.gen.cpp.obj was modified or is new
Building patch from 3 file(s) for Live coding module D:\Unreal Projects\ToonTanks\Binaries\Win64\UnrealEditor-ToonTanks.dll
   Creating library D:\Unreal Projects\ToonTanks\Binaries\Win64\UnrealEditor-ToonTanks.patch_1.lib and object D:\Unreal Projects\ToonTanks\Binaries\Win64\UnrealEditor-ToonTanks.patch_1.exp
Successfully linked patch (0.000s)
Patch creation for module D:\Unreal Projects\ToonTanks\Binaries\Win64\UnrealEditor-ToonTanks.dll successful (0.000s)
---------- Finished (0.000s) ----------
1 Like

Ehhh I just had enough - Visual Studio Code is literally the worst IDE I ever used, it’s very slow, I mean VERY SLOW sometimes I literally need to wait like a 2-3 seconds before it will show me autocompletion or which parameters are accepted in to functions, which for anyone who doesn’t code might not sound that bad but normal IDEs show that instantly. I’ve installed Rider and it’s like comparing driving Volkswagen Golf from 1998 to newest Mercedes E Class. I really regret that I didn’t do that earlier in the course…

I’ll let that topic open in case if anyone else have same problems with Visual Studio Code, and I’m open to test things out with it, but for me it’s not that important now.

I know a fix for this. I can’t explain why it works exactly since I’m still learning all this stuff, but I know it does fix the issue because I was having this same problem and it was making it difficult to parse where I might have been making errors in my code.

So, in order to fix this, you have to go to the folder where your project is located and find the .uproject file. Right Click on the .uproject file and find the option for “Generate Visual Studio project files.” If you’re on Windows 11, you’ll have to select “Show More Options” after right clicking.

Once you’ve done this, you’ll see a new window with a loading bar. When it’s done loading you can simply open the project via the uproject file or from the Epic Games launcher and all include errors and those related should be removed from the code editor.

Here’s a video that shows how to resolve this issue if you’re more of a visual learner like myself: https://www.youtube.com/watch?v=mMfPbbsTwuM&list=PLEs6uO_WC_xow3evqv4XQP9p36rqOtE7a&index=5

I hope this helps!

1 Like

Thanks for detailed explanation + the video :slight_smile: Sadly it looks like for me it does same thing as refreshing the project:


So it fixes the issues in visual studio, but same issues shows up whenever I create other C++ class :frowning: Out of those two solutions i think refreshing is way faster I guess.

Anyways I’m gonna stick with Rider, once you taste it working so flawlessly and quickly you just can’t go back :stuck_out_tongue:

Ahh, that’s interesting… I’m not sure why I thought refreshing didn’t fix this issue for me before. Also not sure why the video shows such a convoluted method of resolving this issue. Just yet another crux I’ll have to live with continuing to use VSC! Ah well. :confused:

Well maybe it didn’t back then - there is a lot of variables I guess, versions of VC, UE editor etc. :stuck_out_tongue: Same goes from method from the video, if I see correctly that person was using UE4, maybe it was the only option of dealing with that :smiley:

Ah, that’s an excellent point!

We’re so spoiled with UE5 now. Instead of having to sift through file paths to resolve include errors, we have a button that’ll do it for us! :laughing: /s

Maybe I’ll consider a different code editor in the near future. I’ve heard that most professionals don’t use VSC anyway, though I have no idea how true that is.

1 Like

Truth is they needed to use IDE that looks totally the same on all systems, computers and that is free - those two factors were far more important then quickness and reliability :stuck_out_tongue:

From what I heard they are not :smiley: People say there are 2 camps: Visual Studio and Rider - VS is lighter and does it job just ok, and Rider needs more resources but it’s powerful and integration with UE is great.

I guess if someone is doing first 2 games from this tutorial, sticking to vscode would be best, but after that point this person should be more then capable of using something slightly different :slight_smile:

Rider have 30 days trial + it’s free for students. Sadly I’m not one, so I’ll have to pay 14€\mo for a year and then I’ll have last version that I paid for available forever - but I’m ok with that because it fixes things that I hated the most about doing those tutorials: dealing with vscode bs, and dumb copying of header’s function names - in rider I can 1 click create function in cpp file :stuck_out_tongue:

Privacy & Terms