I have Precompiled Headers enabled in a static library project I am working on. Looking around other StackOverflow questions, it seems like the key place to #include "stdafx.h" is in the .cpp file, not the .h file.
However, when I do this in Visual Studio, I get an IntelliSense error:
1 IntelliSense: PCH warning: header stop cannot be in a macro or #if block. An IntelliSense PCH file was not generated. ....\Common\Core\Geometry\Ellipsoid.h 9
The static library project does compile successfully, even with this IntelliSense error.
The .h file consists of this class declaration:
#ifndef GEOMETRY_ELLIPSOID_H
#define GEOMETRY_ELLIPSOID_H
class Ellipsoid { // 'class' is underlined with a red line (error)
// ...
};
#endif // !GEOMETRY_ELLIPSOID_H
The .cpp defines the class declared in the header:
#include "Common\Core\stdafx.h"
#include "Ellipsoid.h"
// ...
By including stdafx.h in the header, the intelliSense error disappears. Is this the correct way to use precompiled headers? What implications are there in including stdafx.h in the header?