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

5

54

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)

Churchwoman answered 10/8, 2011 at 15:20 Comment(2)
Does it say so when trying to compile? Or when you try to "run" it? I would assume (but might be wrong) that this Open Source project (which one is it?) relies on CMAKE? In that case it's just a generated project that will cause all other projects to be built. It's most likely not something you can run.Elbertine
The program is blender. I actually compiled it, since i also added a few stuff and now this stuff i added is into the program, i'm sure i compiled it :) Yes, it relies on CMAKE and SCons(you can choose what to use).Churchwoman
E
94

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.

Elbertine answered 10/8, 2011 at 15:42 Comment(7)
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 youChurchwoman
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.Tu
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.Elbertine
You were right!! I found the project that outputted the exe and the debugger run just fine! Thanks!Churchwoman
If anyone had a similar problem, the anti-virus might be blocking the *.exe file (which was my case).Selfish
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).Outthink
thanks @kevin , you saved me from suffer. It is working now, I was trying to modify the CMAKELISTS.txtSnag
D
7

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 ;)

Daughtry answered 10/4, 2013 at 10:12 Comment(0)
K
1

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

Kettle answered 10/8, 2011 at 15:38 Comment(0)
C
1

I encountered this error because the path to the executable exceeded the MAX_PATH length of 260 characters. Enabling long paths in Windows 10 rectified the situation.

Corposant answered 16/5, 2023 at 21:59 Comment(0)
E
0

I don't know if that a good practice or not.

But when i use cmake to build a project and want to start VS debugger, I just remove the ALL_BUILD item from the solution explorer and it works fine from me.

Ernst answered 7/6, 2024 at 3:19 Comment(1)
Your answer could be improved with additional supporting information. Please edit to add details, so that others can confirm that your answer is correct.Sinus

© 2022 - 2025 — McMap. All rights reserved.