The following modules are missing or built with a different engine version

I am having same issue:

  • Unreal Engine 5.2
  • Building and running on Linux (Ubuntu 22.04)
  • Build done via VsCode

The project loads and run correctly. But when I add a c++ file (the project was created with C++ support), closing and reopening the engine causes the error reported here (“modules missing or built with a different…”).

Rebuilding the whole project (clean and rebuild) solves the issue but only temporary: if I add another c++ file, the problem arises again.

Removing the module from the Module section in the .uproject files solves (thanks to everybody here for the workaround!), but I fear there’s something more going on here.

I noticed that after a full build, it was added a new compile command in the .vscode/compileCommands_MYPROJECT.json file, dedicated to the new c++ source file. Adding manually the same command for a new source file doesn’t solve anything, unfortunately.

Does anybody know how the whole build process works and what it expects from a correct build of the project module?

At the current state of things, for me adding a c++ source file to the project doesn’t work for Unreal Engine (at least for 5.2) under Linux using VsCode (the Module section workaround requires a manual correction every time I add a source file and moreover, I fear it could have other side effects).