“The system cannot find the file specified” when r

2019-01-11 18:38发布

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.

11条回答
小情绪 Triste *
2楼-- · 2019-01-11 19:22

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" under Tools>Settings to get a Build' menu.
After clicking Build->Build Solution (or Rebuild), you may verify in Output window (View->Outout), if your application is compiling and linking correctly.

Sources :

Hope it helps.

查看更多
劳资没心,怎么记你
3楼-- · 2019-01-11 19:25

if vs2010 installed correctly

check file type (.cpp)

just build it again It will automatically fix,, ( if you are using VS 2010 )

查看更多
\"骚年 ilove
4楼-- · 2019-01-11 19:27

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.

查看更多
祖国的老花朵
5楼-- · 2019-01-11 19:29

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.

查看更多
爷的心禁止访问
6楼-- · 2019-01-11 19:35

I know this thread is 1 year old but I hope this helps someone, my problem was that I needed to add:

    #include "stdafx.h"

to my project (on the first line), this seems to be the case most of the time!

查看更多
登录 后发表回答