I can not find where the dog buried, when compiling produces an error:

fatal error C1083: Cannot open precompiled header file: 'Debug\QUIK_TRADER.pch': No such file or directory 

In the properties of the project all inclusive (Precompiled Header: Use (/ Yu)), it’s included that they are spelled out, and he (the compiler) writes the same thing! Where to dig, whom to search!?

  • The question arises, in what cases to use the Precompiled Header key Use and in which Create in the project settings? - rejie
  • Try to rebuild the project by force - renegator
  • I have never used it before, now I decided to figure it out, if you create a project from scratch, add all files manually (stdafx.h), select Precompiled Header: Use (/ Yu) project properties, then the ".pch" file itself is not created, due to This is an error, and if you specify Precompiled Header: Create, then the file ".pch" is created! It turns out that if I add new header files to stdafx.h, then I need to select Create in the project properties, and then Use !? - rejie
  • It is updated itself when adding inclodes. If you choose to create a project with the Precompiled Header, it will create it yourself. And everything can break if you lose or rename files. - IronVbif
  • one
    >> I don’t encounter such problems = (((Rather, it’s because you don’t write in c ++. Otherwise, you still couldn’t run into copy-paste function signatures from cpp to hpp and back with all the consequences. - nitrocaster

1 answer 1

Sometimes the solution itself gets buggy (often when deleting any files from the solution folders) and you have to create a new project.

When creating a new project, you must specify the option "Use precompiled header." In the settings (properties) of the project, you must specify the key (/ Yu - Use) in the configuration properties tab - C / C ++ - precompiled headers. The .pch file itself will be created automatically.

In order for the precompiled header to function properly, it is necessary that in the "Solution Explorer" во вкладке "Заголовочные файлы". находился stdafx.h, а во вкладке "Файлы исходного кода" stdafx.cpp. во вкладке "Заголовочные файлы". находился stdafx.h, а во вкладке "Файлы исходного кода" stdafx.cpp. The system itself automatically creates them there.

The file stdafx.cpp should include the file #include "stdafx.h"