The system cannot find the specified file. in visual studio

I keep getting this error with these lines of code:

include <iostream> int main() { cout << "Hello World" >>; system("pause"); return 0; } 

"The system cannot find the specified file"

enter image description here

+6
source share
6 answers

The system cannot find the specified file, as a rule, it means that the assembly failed (which will be for your code, since you are missing # infront from include , you have wandering >> at the end of your cout , and you need std:: infront from cout), but you have the option "run anyway", which means that it runs an executable file that does not exist. Hit F7 to just make the build and make sure it says “0 bugs” before trying to run it.

The code that builds and runs:

 #include <iostream> int main() { std::cout << "Hello World"; system("pause"); return 0; } 
+9
source

The code should be:

 #include <iostream> using namespace std; int main() { cout << "Hello World"; return 0; } 

Or maybe:

 #include <iostream> int main() { std::cout << "Hello World"; return 0; } 

A simple note: I deleted the system command because I heard that this is not a good practice. (but of course you can add it for this program)

+2
source

I had the same problem and this fixed:

You must add:

C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib\x64 for a 64-bit system

C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib for a 32-bit system

in Property Manager > Linker > General > Additional Library Directories

+1
source

Oh my days!

I feel so embarrassed, but this is my first day in C ++.

I was getting an error due to two things.

  • I opened an empty project

  • I did not add #include "stdafx.h"

It worked successfully on win 32 console.

0
source

This is because you did not compile it. Click Project> Compile. Then either click “start debugging” or “start without debugging”.

0
source

Another question that was not mentioned here is that when debugging the project can create, but it will not work, showing an error message in the question.

If so, another view option is the output file compared to the target file. They must match.

A quick way to check the output file is to go to the project properties pages, then go to Configuration properties → Linker → General (In VS 2013 - the exact path may vary depending on the version of the IDE).

There is a parameter "Output file". If this is not $(OutDir)$(TargetName)$(TargetExt) , you may run into problems.

It is also discussed in more detail here .

0
source

Source: https://habr.com/ru/post/950620/


All Articles