How do add c++ source files to BP project?

I’m updating my project with plugins from 4.22 to 4.23 but when I try to generate the Vs project files it said this project doses not have any source code.
So how would I add source code to my BP project?

There no technical difference between C++ and BP project, it just matter if project got C++ module or not. So you need to make one.

Cheapest way without need to explain everything is to make empty C++ project (don’t use template) name does not matter or else you actually gonna use the module, then keep in mind changing name of module (which by default inherent from project name) is pain so choose wisely. Copy Source directory from empty project to project you work on. All you need to do know is add module information to uproject, open uproject of empty project in text editor and search for section that looks like this:

"Modules": [
	{
		"Name": "ModuleName",
		"Type": "Runtime",
		"LoadingPhase": "Default"
	}
]

Copy this in to your project uproject, and then generate VS project files. .uproject file is formatted in so make sure is valid , if VS project generation fails that means it not valid.

Once you done, you can always turn project back to being BP only by… you guess it, removing C++ module from it (you actually only need to remove information about it in uproject). Just keep in mind for UBT, VS project is irrelevant it will always read project configuration for uproject and build scripts (cs files in Source), so if you remove information about module in uproject, project won’t compile even if you got VS project.