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.
I have recently not used VS 2010.
Does your application really build correctly? To get more control in
VS 2010 C++ Express
, you can check menu item "Expert Settings
" underTools>Settings
to get aBuild' menu
.After clicking
Build->Build Solution
(orRebuild
), you may verify inOutput
window (View->Outout
), if your application is compiling and linking correctly.Sources :
Hope it helps.
if vs2010 installed correctly
check file type (.cpp)
just build it again It will automatically fix,, ( if you are using VS 2010 )
I know this is an old thread, but for any future visitors, the cause of this error is most likely because you haven't built your project from
Build > Build Solution
. The reason you're getting this error when you try to run your project is because Visual Studio can't find the executable file that should be produced when you build your 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.
I know this thread is 1 year old but I hope this helps someone, my problem was that I needed to add:
to my project (on the first line), this seems to be the case most of the time!