Visual Studio debugger error: Unable to start program Specified file cannot be found

161,482

Solution 1

Guessing from the information I have, you're not actually compiling the program, but trying to run it. That is, ALL_BUILD is set as your startup project. (It should be in a bold font, unlike the other projects in your solution) If you then try to run/debug, you will get the error you describe, because there is simply nothing to run.

The project is most likely generated via CMAKE and included in your Visual Studio solution. Set any of the projects that do generate a .exe as the startup project (by right-clicking on the project and selecting "set as startup project") and you will most likely will be able to start those from within Visual Studio.

Solution 2

I had the same problem :) Verify the "Source code" folder on the "Solution Explorer", if it doesn't contain any "source code" file then :

Right click on "Source code" > Add > Existing Item > Choose the file You want to build and run.

Good luck ;)

Solution 3

I think that what you have to check is:

  1. if the target EXE is correctly configured in the project settings ("command", in the debugging tab). Since all individual projects run when you start debugging it's well possible that only the debugging target for the "ALL" solution is missing, check which project is currently active (you can also select the debugger target by changing the active project).

  2. dependencies (DLLs) are also located at the target debugee directory or can be loaded (you can use the "depends.exe" tool for checking dependencies of an executable or DLL).

Share:
161,482
Makers_F
Author by

Makers_F

Updated on July 09, 2022

Comments

  • Makers_F
    Makers_F almost 2 years

    I have a solution in C:\full path here\VS2010\blender.sln

    This solution contains many projects(around 100). When I compile them, they all work fine. I can run them without any problem, and (quite) everything works (there are some bugs). One of the projects is ALL_BUILD, but it gives the same error if I try to debug INSTALL(another project). I'm compiling with RELWithDebInfo as configuration, and if I execute the program manually it works. It is outputted in C:\full path here\VS2010\bin\RelWithDebInfo

    But if I try to run the compiler, it says

    "Unable to start program C:\full path here\VS2010\RelWithDebInfo\ALL_BUILD Specified file cannot be found"

    I tried to copy the compiled program into the path required by VS, but it raised the same error.

    What should I do to solve this? Right now I set up cmake to generate also a mingw project and I compile it and debug it with gdb, but this is a really a slow and impractical workflow, and I would like to use the VS debugger.

    I must say that if I compile with Debug as configuration, the program doesn't even start.

    I'm using VS2010 Express on Win7 64bit

    (This is a big open source program, so I don't know exactly whatever it does)

  • Makers_F
    Makers_F over 12 years
    i'll try. Btw all the projects generate a lib project, except the INSTALL one(i'm building it to compile my program). I'll try setting it as the startup project. Thank you
  • longbkit
    longbkit over 12 years
    If so then you do not have any thing to run. INSTALL project to my view is only a setup project which create installation file.
  • Bart
    Bart over 12 years
    I agree. I don't believe your INSTALL project is outputting any executable at all. It has to be one of the other projects that does so.
  • Makers_F
    Makers_F over 12 years
    You were right!! I found the project that outputted the exe and the debugger run just fine! Thanks!
  • p8me
    p8me over 9 years
    If anyone had a similar problem, the anti-virus might be blocking the *.exe file (which was my case).
  • Mojca
    Mojca over 5 years
    This answer initially solved my problem and I was able to run the executable, but I had troubles elsewhere (with cuda debugging etc.). Cleaning CMake cache and generating/rebuilding the project again solved the issue. Just regenerating and rebuilding CMake did not help (apparently adding new files, targets, languages etc. broke the project state at some point).
  • BiMo
    BiMo about 2 years
    thanks @kevin , you saved me from suffer. It is working now, I was trying to modify the CMAKELISTS.txt