0

cannot open source file stdafx.h or <stdafx.h>

Yes I understand what precompiled headers are

I have been struggling the past hour trying to get a precompiled header stdafx.h to my project as I'm getting the error:

"cannot open source file "stdafx.h".

I tried the Precompiled Header list under Project/Properties and tried making a new temporary project that other suggestions say to just copy from there, but the only ones I see come in <iostream> instead

I've read every other solution here and I'm frustrated why its still not working.

In my header file, it says its using stdafx.h, and I tried both "don't use a precompiled header" and the one I've been suggested through guides. Just want my stdafx.h in my code to work.

Followed past posts here in the past(latest 2016)

changed precompiled header list and tested/messed with the options following suggestions

Tried creating a temporary file pulling the header from there, it wasn't there.

Felipe Augusto
  • 7,733
  • 10
  • 39
  • 73
  • 3
    Precompileed header configuration has *nothing* to do with the compiler telling you it cannot even *find* `stdafx.h`. The compiler is telling you that header cannot be *found*; period. Ask yourself why is that? Can *you* open that header? Is it in your vc++ project ? source/headers tree ? Is it in the same disk folder as the rest of your source/header files? I can tell you how to configure pch, but first make damn sure you have the header on which you wish to base pch on even available. – WhozCraig May 26 '19 at 00:07
  • (If you want to turn them off) Sometimes precompiled headers are turned on on a file-by-file basis, so you may check properties on individual header files too, rather than just the project settings. – AndyG May 26 '19 at 00:22
  • Do you need to use Precompiled Headers? How much build time has it saved you? In my experience, the amount of build time is insignificant, especially compared to the side-effects it causes. – Thomas Matthews May 26 '19 at 04:37

0 Answers0