c++ 编译找不到 .pch

Reference:https://www.viva64.com/en/b/0265/

  1. Enable precompiled headers in all configurations for all *.cpp files. It can be done on the “Precompiled Header” tab:
    a. Set the value “Use (/Yu)” for the “Precompiled Header” option.
    b. Set “stdafx.h” for the “Precompiled Header File” option.
    c. Set “ ( I n t D i r ) (IntDir) (IntDir)(TargetName).pch” for the “Precompiled Header Output File” option.
  2. Create an stdafx.h file, and add it into the project. We will include those headers we want to be preprocessed in advance into this file.
  3. Create an stdafx.cpp file, and add it into the project. This file has only one line: #include “stdafx.h”.
  4. Change the settings for the stdafx.cpp file in all configurations; set the value “Create (/Yc)” for the “Precompiled Header” option.

posted on 2024-04-12 11:01  norsd  阅读(4)  评论(0编辑  收藏  举报  来源

导航