Is there a way to use pre-compiled headers in VC++ without requiring stdafx.h?

后端 未结 9 739
予麋鹿
予麋鹿 2020-12-05 16:20

I\'ve got a bunch of legacy code that I need to write unit tests for. It uses pre-compiled headers everywhere so almost all .cpp files have a dependecy on stdafx.h which is

9条回答
  •  情深已故
    2020-12-05 16:54

    Yes. The "stdafx.h/stdafx.pch" name is just convention. You can give each .cpp its own precompiled header. This would probably be easiest to achieve by a small script to edit the XML in your .vcproj. Downside: you end up with a large stack of precompiled headers, and they're not shared between TU's.

    Possible, but smart? I can't say for sure.

提交回复
热议问题