As the error itself explains that we are not able to start the program because the system cannot find the file. Errors of this kind always occur due to adding the file to the project in the wrong way either by mistake or other way. Microsoft Visual has an annoying issue of not adding files to the project if we add via the file menu of the Visual C++, god knows why? And if we try to compile, we will end up receiving errors.
Although this error has the simplest solution, we just have to add our .cpp file to the source folders in the project yourself.
There are two simple methods to add files in the source folder of the project.
- Open project
- Right click on the “source files” folder
- Select add
- Hit new item
- Add files via project menu, go to project
- Select add new items
- Choose your cpp file
- Hit add
You can use either of them to resolve the error. After doing this you can successfully compile and run your project file.
Hope this will help.