The system cannot find the file specified. in Visual Studio
I had a same problem and this 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
The system cannot find the file specified usually means the build failed (which it will for your code as you're missing a #
infront of include
, you have a stray >>
at the end of your cout
line and you need std::
infront of cout) but you have the 'run anyway' option checked which means it runs an executable that doesn't exist. Hit F7 to just do a build and make sure it says '0 errors' before you try running it.
Code which builds and runs:
#include <iostream>
int main()
{
std::cout << "Hello World";
system("pause");
return 0;
}
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;
}
Just a quick note: I have deleted the system command, because I heard it's not a good practice to use it. (but of course, you can add it for this kind of program)