Currently viewing: GipsySoft » Front Page» Articles

How can I use a different header and cpp file for precompiled headers (Visual C++)

  • Go to Project|Settings (ALT-F7)
  • Select the C/C++ tab on the right.
  • From the "Category" drop down select "Precompiled Headers"
  • Select all of your project files in the list on the left
  • On the right select the "Use precompiled..." radio button and in the edit box type the name of your precompiled header "precomp.h".
  • Now select the "precomp.cpp" source file on the list on the left and and on the right select the "Create..." radio button, in the edit box type the name of your precompiled cpp file "precomp.cpp".

It's easy when you know where to look, and knowing that there is one source file reponsible for building the precompiled header makes life easier. Setting all other source files to use the precompiled header is straightforward