VS Code: C++ sources and IntelliSense
Compilation database, workspace and diagnostics without invented defines.
VS Code for C++ sources
For game C#, open the game project and use the C# guide. This page configures the engine C++ tree containing SConstruct. The C/C++ extension does not install the compiler, SDK and SCons for you.
Open the right folder
- Open
Source, containing SConstruct, core, scene, editor and platform. Opening its parent makes${workspaceFolder}paths in the example point elsewhere. - Use Microsoft C/C++ and a compiler matching the platform/architecture configured in SCons. If using another analyzer, check its own settings; configuring one extension does not configure all others.
- Preserve existing
.vscodefiles: extend the relevant configuration rather than deleting someone else's tasks.json or launch.json to fit an example.
Connect compilation commands
You need a current compile_commands.json from this source-tree configuration. The IDE overview explains compiledb and compiledb_gen_only. Generating the database is not engine compilation, but still requires successful SCons configuration.
Known limitation: current methods.py helpers import SCons.Entity, which installed SCons 4.11.1 does not provide. Isolated calls raise ImportError. Full database generation was not performed here. Do not treat the JSON below as a fix for that failure or invent a database instead of obtaining build-system output.
If you already have a correct database for your configuration, create or extend Source/.vscode/c_cpp_properties.json:
{
"configurations": [
{
"name": "Reckfell Source",
"compileCommands": "${workspaceFolder}/compile_commands.json"
}
],
"version": 4
}For a file with a matching entry, the extension uses its database command. Without an entry, base settings apply; an existing JSON file does not guarantee correct indexing for every file. Select a real compilerPath through C/C++: Edit Configurations (UI) for base configuration. Do not copy Windows SDK versions or MSVC paths from another computer. See official IntelliSense configuration.
Do not add TESTS_ENABLED, TOOLS_ENABLED or other defines merely to hide underlines. They must match the actual configuration. Refresh the database after changing target, arch, modules or source files. Generated headers must also exist; adding ** to includePath does not create them.
Configure building and launching separately
A build task should invoke a command already verified for your configuration, from the correct working directory. Building the active C++ file does not build the whole engine and its dependencies. Separate command and argument array in tasks.json; see VS Code documentation for task schema and shell/process differences.
Native launching is separate from IntelliSense. For launch.json, choose the installed adapter configuration and the actual binary with matching symbols. Do not mix different adapters' fields. preLaunchTask must match an existing task label. See the Microsoft C/C++ reference for adapter fields. Debugger attachment was not tested in this run.
Diagnose the problem
| Symptom | Check |
|---|---|
| ImportError mentioning SCons.Entity | This is an observed helper problem; IntelliSense settings cannot fix it. |
| Missing header | Workspace, matching .cpp entry, compiler/SDK paths and existence of the generated file. |
| Wrong C++ branch analyzed | Database freshness, selected configuration and another active configurationProvider. |
| Task works in only one terminal | Compiler/toolchain PATH and environment differences; inspect task output rather than only its exit code. |
| Indexing works but building fails | These are different operations: inspect the actual SCons command and its first error. |
The JSON example was parsed and checked against fields in the installed C/C++ Tools 1.34.4 schema; this is not full JSON Schema validation or IntelliSense execution. SCons option names were checked in source, and helper failures remain separate evidence. A full database, build, VS Code UI and native debugging were not verified. The engine was unchanged.