0

I'm running a C++ calculator tutorial.

How do I solve the following errors regarding "#include "stdafx.h""?

Errors: "Severity Code Description Project File Line Suppression State Error (active) E1696 cannot open source file "stdafx.h" Calculator Tutorial C:\Users\user\source\repos\Calculator Tutorial\Calculator Tutorial\Calculator Tutorial.cpp 4 "

"Severity Code Description Project File Line Suppression State Error C1083 Cannot open include file: 'stdafx.h': No such file or directory Calculator Tutorial C:\Users\user\source\repos\Calculator Tutorial\Calculator Tutorial\Calculator Tutorial.cpp 4 "

References: https://tutorials.visualstudio.com/cpp-calculator/Debug

  • Try `#include "pch.h"` instead of `#include "stdafx.h"` – drescherjm Oct 27 '20 at 13:38
  • That's just changing the name of the header. – Jonh Smith Benjamin Oct 29 '20 at 09:21
  • Correct. Using the windows console project template in a modern version of Visual Studio Community (or one of the paid versions) with precompiled headers enabled pch.h is the default name of the header generated for precompiled headers – drescherjm Oct 29 '20 at 12:50
  • If you have neither file in your folder because you created a project without precompiled headers you have to remove that include and most likely add #include and then fix the errors. – drescherjm Oct 29 '20 at 12:54

0 Answers0