question

Harper-7125 avatar image
0 Votes"
Harper-7125 asked IsaacTait-9448 edited

Visual Studio 2019 Unable to start program, the system cannot find the file specified

Hello everyone, current I am trying to run a program on Visual Studio but unfortunately it will not work. Whenever I try to run the project, I get an error as can be seen below.
112315-image.png


For reference, I am using some file from opencv and have included what I was told into my linker and directories under the property tab. This is also a c++ project. I am really stumped on how to fix this and would appreciate some guidance.

c++
image.png (202.8 KiB)
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.


I do not think that you should click “Yes” when Visual Studio asks “There were build errors. Would you like to continue and run the last successful build?”.

If you also accidentally selected the “Do not show this dialog again” checkbox, then go to menu, TOOLS, Options, Projects and Solutions, Build And Run, and select “Do not launch” or “Prompt to launch” from the “On Run, when build or deployment errors occur” list.

Otherwise, it looks like a relapse after fixing another issue — https://docs.microsoft.com/en-us/answers/questions/456919/ — which you probably forgot to finalise.


0 Votes 0 ·
WayneAKing-0228 avatar image
0 Votes"
WayneAKing-0228 answered

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

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

SimpleSamples avatar image
0 Votes"
SimpleSamples answered SimpleSamples edited

Look at the output in the image you posted. It has:

 1>LINK : Fatal error LNK1194: cannot open File 'opencv_calib3d4S2d.1ib'

You need to fix that. The link did not work; that is why the exe file does not exist.

Do you know what directory that file is in? In VS go to the project's properties and in the VC++ Directories add that directory to the Library Directories as in VC++ Directories Property Page.


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

WayneAKing-0228 avatar image
0 Votes"
WayneAKing-0228 answered SimpleSamples edited

In the Project Properties, under Linker->General have
you set "Additional Library Directories" to tell the
Linker where to find the opencv *.lib files?

  • Wayne

· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

We seem to have posted that at the same time.

0 Votes 0 ·

We seem to have posted that at the same time.

Indeed we did. That happens from time to time, when
two or more people compose replies and post them
without having seen the replies that others have
submitted since they last read the thread.

Note that the Linker property I suggested was present in
VS 2017 and earlier, but as I don't have VS 2019 installed
I can't confirm that it still exists.

  • Wayne

0 Votes 0 ·

I also have not installed VS 2019 and am still using VS 2017. The link I posted has instructions for VS 2019 (or VS 2017 if selected).

0 Votes 0 ·
IsaacTait-9448 avatar image
0 Votes"
IsaacTait-9448 answered IsaacTait-9448 edited

For anyone with similar issues (without errors or warning though) I resolved by creating the code files within the project. More info here


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.