This is my first time working with C++ and properly getting into coding. I'm following the C++ tutorials on learncpp.com and I'm using Visual Studio 2017...
In the tutorial they start off with some simple "Hello, world!" code and at top of the code they put #include "stdafx.h"
along with #include <iostream>
. When I replicate this code myself and try to build it, I get the error:
C1010: unexpected end of file while looking for precompiled header. Did you forget to add #include "pch.h" to your source?
When looking at my solution explorer I noticed that in their tutorial in the header and source files tab they have files called "stdafx.h" and "stdafx.cpp", but for me those files are called "pch.h" and "pch.cpp".
So I then tried renaming the #include "stdafx.h"
to #include "pch.h"
and the code was built and executed perfectly. So should I just stick with #include "pch.h"
for the rest of my code or is this some kind of issue?
Thanks!
stdafx.h
. Precompiled headers are not needed. – HSKProject properties
->C / C++
->Precompiled header
tab. It can be set on per translation unit basis. – user7860670