I installed Visual Studio 2010. I wrote a simple code which I'm sure is correct but unfortunately, when I run the code, I get the error below.
Here is my code:
#include<iostream>
using namespace std;
int main (){
cout <<"Hello StackOverFlow ;)";
return 0;
}
And here is the error:
Unable to start program 'C:\Users\Soheil\Desktop\New folder\sam\Debug\sam.exe The system cannot find the file specified
Would you help me solve the issue? Should I define the project in a specific directory? I've spent a ton of hours to solve this issue and have not had any success yet.
Use SFC to fix system cannot finds the file specified error. In Command Prompt, type the following command: “sfc /scannow”. Now press Enter. After scanning and correcting errors, restart the computer and check if the “system cannot find the file specified” error is fixed.
As you know, most people encounter "the system cannot find the file specified" error when trying to access or back up some data. This is because the file system of the target device is corrupted or damaged, making your hard drive, USB or external hard drive inaccessible.
I resolved this issue after deleting folder where I was trying to add the file in Visual Studio. Deleted folder from window explorer also. After doing all this, successfully able to add folder and file.
This is a first step for somebody that is a beginner. Same thing happened to me:
Look in the Solution Explorer box to the left. Make sure that there is actually a .cpp
file there. You can do the same by looking the .cpp
file where the .sln
file for the project is stored. If there is not one, then you will get that error.
When adding a cpp file you want to use the Add new item icon. (top left with a gold star on it, hover over it to see the name) For some reason Ctrl+N does not actually add a .cpp
file to the project.
Encountered the same issue, after downloading a project, in debug mode. Searched for hours without any luck. Following resolved my problem;
Project Properties -> Linker -> Output file -> $(OutDir)$(TargetName)$(TargetExt)
It was previously pointing to a folder that MSVS wasn't running from whilst debugging mode.
EDIT: soon as I posted this I came across: unable to start "program.exe" the system cannot find the file specified vs2008 which explains the same thing.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With