How to fix .pch file missing on build?

后端 未结 10 1060
日久生厌
日久生厌 2020-11-29 15:18

When I build my c++ solution in Visual Studio it complains that the xxxxx.pch file is missing. Is there a setting I am missing to get the pre-compiled headers back?

10条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-29 15:55

    Fix:

    1. Make sure you have xxxxx.cpp in your project

    2. Compile xxxxx.cpp with /Yc flag (Create Precompiled Header)
      (right click on xxxxx.cpp -> properties -> Precompiled Headers -> create)

    3. Compile all other files with /Yu flag (Use Precompiled Header)
      (right click on project -> properties -> Precompiled Headers -> use)

提交回复
热议问题