开发者

How to force Visual Studio 2008 to warn about missing header files

I work as the Mac coder on a c++ application which I share with PC coders who use VS2008. When they make changes to a source file that requires an non-included header file they get no warnings开发者_Go百科, as most of their headers are in a precompiled header. What setting can they use to have them be warned that they failed to add the required include?

Would make my life easier as GCC requires the includes be actually present.


Er... Your question as stated is based on an incorrect premise.

All headers in VS compiler are required to be included. There's no way around it.

Precompiled headers feature does not affect this general principle it any way. The only difference is that in projects that plan to use precompiled headers the headers are normally included indirectly, through a special intermediate header file. Nevertheless, you can't just forget to include some header file, regardless of whether the project is using precompiled headers or not. All headers must be included in all cases, directly or indirectly.

A project that's using precompiled headers will compile perfectly fine on any compiler that knows nothing about any precompiled headers at all.

So, the situation you describe simply cannot happen in practice. If it does, they you must be leaving out some important detail about the problem.


I would make the precompiled headers conditional on a define that is only present on the PC code, or vice versa for the mac code.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜