Microsoft visual studio unable to start program the system cannot find the file specified

I am having a similar issue as this post. However, on build I have 0 errors, 0 warning, and 0 messages.

I took a look at Project -> Properties but I do not seem to have a linker option (which appears to be a typical fix that others have used to solve this issue).

I have also tried Rebuilding Solution and then running but that does not seem to work either...

Microsoft visual studio unable to start program the system cannot find the file specified

Based on the aforementioned similar issue I understand the premise that "when an exe cannot be created (or in my case - found)... then naturally it cannot be run as it does not exist". However, I do not understand where the disconnect is occurring that is preventing this file from either being found or created...

Any help sorting this out would be greatly appreciated. Cheers.

Microsoft visual studio unable to start program the system cannot find the file specified


If you don't want to see the message in the popup
dialog that you used in the Subject of this thread,
then stop trying to run a program before it has been
built successfully.

If the compile fails, no object file (*.obj) will be
created so the link step will fail. If the compile
is successful and an obj file is created, but the link
step fails for some other reason - such as not being
able to find a lib file as in the case shown in your
pic - then an exe will not be created.

When an exe cannot be created because of compile and/or
link errors, then naturally it can't be run as it doesn't
exist. I suggest you stop trying to run all the time,
relying on implicit building, and start doing an explicit
Build (F7) or Rebuild. Fix all errors shown in the Build
Output - and preferably fix all Warnings as well - and only
then try to Run the program.

The Link error in the image you posted is sufficiently
explicit that you should be able to resolve why the
Linker can't find the .lib specified.

  • Wayne

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
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.

pmr

57.7k10 gold badges110 silver badges155 bronze badges

asked May 12, 2013 at 20:51

21

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.

Microsoft visual studio unable to start program the system cannot find the file specified

answered Nov 9, 2013 at 17:44

cdelsolacdelsola

3972 gold badges7 silver badges17 bronze badges

1

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.

answered Mar 20, 2016 at 5:51

ReturnVoidReturnVoid

1,0711 gold badge10 silver badges17 bronze badges

0

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.

answered Oct 31, 2015 at 16:14

Microsoft visual studio unable to start program the system cannot find the file specified

Ethan BierleinEthan Bierlein

3,2434 gold badges27 silver badges41 bronze badges

1

As others have mentioned, this is an old thread and even with this thread there tends to be different solutions that worked for different people. The solution that worked for is as follows:

Right Click Project Name > Properties
Linker > General 
Output File > $(OutDir)$(TargetName)$(TargetExt) as indicated by @ReturnVoid
Click Apply

For whatever reason this initial correction didn't fix my problem (I'm using VS2015 Community to build c++ program). If you still get the error message try the following additional steps:

Back in Project > Properties > Linker > General > Output File > 

You'll see the previously entered text in bold

Select Drop Down > Select "inherit from parent or project defaults"
Select Apply

Previously bold font is no longer bold

Build > Rebuild > Debug

It doesn't make since to me to require these additional steps in addition to what @ReturnVoid posted but...what works is what works...hope it helps someone else out too. Thanks @ReturnVoid

answered Apr 9, 2016 at 22:24

Microsoft visual studio unable to start program the system cannot find the file specified

ChrisChris

9241 gold badge16 silver badges37 bronze badges

1

I came across this problem and none of these solution worked 100%

In addition to ReturnVoid's answer which suggested the change

Project Properties -> Linker -> Output file -> $(OutDir)$(TargetName)$(TargetExt)

I needed to changed

Project Properties -> C/C++ -> Debug Information Format -> /Zi

This field was blank for me, changing the contents to /Zi (or /Z7 or /ZI if those are the formats you want to use) allowed me to debug

answered Jan 9, 2019 at 15:58

rtpaxrtpax

1,64716 silver badges31 bronze badges

For me, I didn't have my startup project set in Solution Explorer.

Go to Solution Explorer on the left of VS, right click your unit test project, and choose "set as startup project".

I had just ported my code to a new workspace, and forgot that when I opened the project in VS in the solution there, that I needed to re-set my startup project.

answered Apr 11, 2017 at 15:35

Microsoft visual studio unable to start program the system cannot find the file specified

MicheleMichele

3,39611 gold badges43 silver badges77 bronze badges

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!

answered May 28, 2014 at 0:25

Windows65Windows65

571 silver badge7 bronze badges

2

I got this problem during debug mode and the missing file was from a static library I was using. The problem was solved by using step over instead of step into during debugging

answered Apr 26, 2019 at 0:25

Microsoft visual studio unable to start program the system cannot find the file specified

mistymisty

111 silver badge4 bronze badges

if vs2010 installed correctly

check file type (.cpp)

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

answered Aug 12, 2014 at 12:35

ANJiANJi

278 bronze badges

I had a same problem and i could fixed it! you should add C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib\x64 for 64 bit system / C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib for 32 bit system in property manager-> Linker-> General->Additional library Directories

maybe it can solve the problem of somebody in the future!

answered Sep 6, 2014 at 15:26

How to fix the system cannot find the file specified in Visual Studio?

To fix Unable to start program, The system cannot find the file specified error in Visual Studio, follow these steps:.
Restart Visual Studio..
Verify the project file..
Run as administrator..
Add exclusion in antivirus..
Reset Visual Studio..

How to use Visual Studio for CPP?

To create a C++ project in Visual Studio.
From the main menu, choose File > New > Project to open the Create a New Project dialog box..
At the top of the dialog, set Language to C++, set Platform to Windows, and set Project type to Console..
From the filtered list of project types, choose Console App then choose Next..

How to compile on Visual Studio?

Build and run your code in Visual Studio.
To build your project, choose Build Solution from the Build menu. The Output window shows the results of the build process..
To run the code, on the menu bar, choose Debug, Start without debugging. A console window opens and then runs your app..