Rebuild precompiled header

Azuan picture Azuan · Nov 6, 2011 · Viewed 19.9k times · Source

I am trying to use MFC with ProC.
Functions.pc is where I do the ProC syntax to connect to the database. So I include the 'Functions.h' in the dialog model where I want to call the functions in 'Funtions.h'. And now I got this error.

    Add directive to 'stdafx.h' or rebuild precompiled header

I understand that I need to include 'stdafx.h' to 'Functions.h' for it to work. And I did that. It can compile,but then when I try to run the program,it won't recognize the syntax of ProC created by the 'Functions.cpp' created. I don't really understand how to rebuild the precompiled header since I don't understand the codes in 'stdafx.h'.

Answer

parapura rajkumar picture parapura rajkumar · Nov 6, 2011

The common way to use precompiled headers on windows is

  1. Include system , third party headers or infrequently changing headers in stdadx.h
  2. stdafx.cpp usually only includes stdafx.h
  3. All your project cpp files include stdafx.h as the first header
  4. Your project header files should not include stdafx.h

To trigger a precompiled header rebuild,

  1. Modify stdafx.h and do an incremental build
  2. Or Do a rebuild project