Required file "tracker.exe" is missing - c++

First time using Visual C++ in Visual Studio and I'm trying to teach myself C++ from some books. I am just trying to do a basic "Hello World" program and its getting a couple errors that I don't know anything about, as well as a bizarre warning. The missing source file seems to be standard and I can't figure it out.
The errors:
Error 2 error : Required file "tracker.exe" is missing.
Error 3 IntelliSense: cannot open source file "SDKDDKVer.h"
The warning:
warning MSB8003: Could not find WindowsSDKDir variable from the registry. TargetFrameworkVersion or PlatformToolset may be set to an invalid version number.
The code:
#include "stdafx.h"
#include <iostream>
using namespace std;
int main()
{
cout << "Hello World!" ;
// This prevents the Console Window from closing during debug mode
cin.ignore(cin.rdbuf()->in_avail());
cout << "\nPress only the 'Enter' key to exit program: ";
cin.get();
return 0;
}
Any explanations or help would be huge! Thanks.

Here's a standard C++03 "hello, world!":
#include <iostream>
using namespace std;
int main()
{
cout << "Hello, world!" << endl;
}
Turn off precompiled headers in the project settings. Make that compile without adding anything. Run it via Ctrl F5 (alternatively place a breakpoint on the final } and run it via the debugger, e.g. keypress F5).
If that doesn't work then you have configuration error. Then try first a new project. If that doesn't work, uninstall VS and reinstall it.

Related

Visual Studio cannot find my C++ hello world file

#include <iostream>
int main()
{
std::cout << "Hello World" << endl;
return 0;
}
When I try to run this code, this message keeps popping up even though I copied and pasted straight from online. There are no build errors either.
Here's the error message
Nothing wrong with your code. Could be your antivirus deleting the exe before visual studio can start it. Try disabling your antivirus and run from VS again.
If not antivirus, then something else is deleting it.
Check if the exe shown in the path in your image is really there or not.
If you click Build -> Build Solution, you will get an error:
error C2065: 'endl': undeclared identifier.
I suggest you should try to use std::endl
Here is the code:
#include <iostream>
int main()
{
std::cout << "Hello World" << std::endl;
return 0;
}
And then you could try to run this code:
I added the file from the new file option not directly from the source file once I created the c++ project.
that error means that the .exe file is most likely still running. it may be that you closed it trough the "X" button, but the VS debugger is still running, so try clicking on the red square to stop it or go in your task manager and manually kill the process.
it may also be that the exe is opened by another process such as a hex editor which is denying further execution access to the file, but i have had this issue personally before and the fix above worked.

Over 400 errors when using Visual Studio C++

I am working on some coursework and the code works perfectly fine on the university system but when I transfer the exact same code to my own PC, I get over 400 error messages. These consist of:
Cannot open source file "name.h"
The global scope has no "name"
identifier "name" is undefined
explicit type is missing ('int' assumed)
A full list is here https://pastebin.com/CRJd7hAp
I get these errors on all of my code, even something as simple as a Hello World program
#include <iostream>
using namespace std;
int main()
{
cout << "Hello world! " << endl;
system("pause");
return 0;
}
I am at a loss as for what to do.
I reinstalled Visual Studio and set the SDK from 8.1 to the newest release. Everything is working fine now. Thank you

Run C++ program in Terminal

I'm trying to run this simple C++ code in Sublime Text on Terminal but it's not exactly working...
#include <iostream>
using namespace std;
int main() {
cout << "Hello world!" << endl;
return 0;
}
I'm getting this message instead:
"hello_world2.cpp:1:10: fatal error: 'iostream' file not found"
How can I fix this?
You most probably are missing development headers for your C++ standard library.
You didn't say anything about your environment, but if you were on Windows on Mac you would for sure get these together with your compiler, so let's assume Linux.
You need to install libstdc++-devel package or equivalent (libstdc++-4.8-dev etc.)

The system cannot find the file specified. 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 file specified"
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)
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
Another take on this that hasn't been mentioned here is that, when in debug, the project may build, but it won't run, giving the error message displayed in the question.
If this is the case, another option to look at is the output file versus the target file. These should match.
A quick way to check the output file is to go to the project's property pages, then go to Configuration Properties -> Linker -> General (In VS 2013 - exact path may vary depending on IDE version).
There is an "Output File" setting. If it is not $(OutDir)$(TargetName)$(TargetExt), then you may run into issues.
This is also discussed in more detail here.
This is because you have not compiled it. Click 'Project > compile'. Then, either click 'start debugging', or 'start without debugging'.
I resolved this issue after deleting folder where I was trying to add the file in Visual Studio. Deleted folder from window explorer also. After doing all this, successfully able to add folder and file.
I was getting the error because of two things.
I opened an empty project
I didn't add #include "stdafx.h"
It ran successfully on the win 32 console.

visual studio 2012 c++ hello world - iostream not working

I have an issue with Visual Studio's 2012. I am also using "Sams Teach Yourself C++ in One Hour a day, 7th edition".
After using google to find the "best" compilers for C++, Visual Studios seemed to be the tool of choice.
So I downloaded and installed Visual Studios 2012. The very first lesson in the book is (and tells me to run it as a console app by going to File > New > Project >Visual C++ > Win32 > Console Application )
#include <iostream>
int main()
{
std::cout << “Hello World!” << std::endl;
return 0;
}
which doesnt work, at all. it outputs an error message similiar to the following:
1>c:\users\nik\documents\visual studio
2012\projects\consoleapplication4\consoleapplication4\consoleapplication4.cpp(8):
error C2065: '“Hello' : undeclared identifier
1> Generating Code...
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped =========="
(there is more lines similiar to the first, but its rather long)
However, after googling and watching a video on youtube the following code works (using File > New > Project >Visual C++ > General > Empty Project )
#include <iostream>
#include "conio.h"
using namespace std;
int main() {
cout << "Hello Nik" << endl;
_getch();
return 0;
}
Does Visual Studio's 2012 have a C++ compiler? or does it just have a visual c++ compiler (if thats even the issue, only reason I think it could be is I can see templates for Visual C++ but none for c++ by itself...) or do I need to download Visual Studio Express to download native c++ ??
Any help would be greatly appreciated as I am feeling some-what out of my depth here...
Thanks.
Besides aphostrophes you may need to disable precompiler headers in project properties.
They are turned on by default in VS2012. If you are not familiar with precompiled headers turn them off.
Right click on project (not solution)
Click properties.
Expand "Configuration properties"
Expand "C/C++"
Choose "Precompiled headers"
Set "Precompiled header" to "Not Using Precompiled Headers"
More information about precompiled headers and stdafx.h file at Wikipedia
The apostrophes you used are wrong:
“Hello World!”
should be
"Hello World!"
Notice even how SO recognizes the difference. You should at least type the code you see in the book instead of copying and pasting it. ;-)
The Win32 console application is actually quite different from the empty project. Win32 utilize a message (input) queue which you poll in a loop and your program respectively utilizes the Win32 API and performs certain operations.
The empty project is a bit less dependent on Win32 or anything that Windows provides in terms of API unless you make it dependent on it. This would be the simples hello world app in you empty project:
#include <iostream>
using namespace std;
int main()
{
cout << "Hello World" << endl;
return 0;
}
Just try this::
"Hello World!" instead of “Hello World!”.
The difference between
“Hello World!” and
"Hello Nik" is the apostrophe.
Aslo is the error persists than just check visual c++ library linker.
There is aslo definitely no need for conio.h
If your going to copy from a book at least copy it correctly.
Using namespace std;
would be pretty smart in this case.
In order to fix your error you have to delete std:: of std::cout and std::endl, and write using namespace std; underneath #include iostream and and change “ ” with " ".
#include <iostream>
using namespace std;
int main()
{
cout <<"Hello World" << endl;
return 0;
}
In Visual studio 2012
file>new projet>visual c++ (Project win32)>application settings(application console+Not Using Precompiled)>in right box in you Project (right click, add>new element>file c++).