explanation of the "#import directives in the precompiled header should use the no_implementation attribute" build system warning
Posted by - NA - on 17 January 2006 04:35 PM
Symptom: The following build system warning appears in builds: "IncrediBuild: build system warning: #import directives in the precompiled header should use the no_implementation attribute. See FAQ section in documentation for more details.". |
IncrediBuild is notifying you of an #import directive that was found in the precompiled header source file, without the "no_implementation" keyword. While most chances are your code will build just fine even with this warning is given, this is problematic for two reasons:
1. You may get "file not found" compilation errors if a source file #includes a .TLI file that was generated by this PCH. Using #import with the "no_implementation" flag in the PCH file, as described below, will solve this.
2. Not using this keyword may slow down compilation as a result of larger PCH files.
The following excerpt is from the MSDN Library "#import" topic:
"The implementation_only attribute is intended for use in conjunction with the no_implementation attribute as a way of keeping the implementations out of the precompiled header (PCH) file. An #import statement with the no_implementation attribute is placed in the source region used to create the PCH. The resulting PCH is used by a number of source files. An #import statement with the implementation_only attribute is then used outside the PCH region. You are required to use this statement only once in one of the source files. This will generate all the required wrapper member functions without additional recompilation for each source file."