Skip to main content
GameDev.net gamedev.net
🔒 Locked

stdafx.h

Started by Abob May 22, 2002 at 11:06 PM 1 replies 200+ views
Original Post
Abob
Abob
VC++ generates a file “stdafx.h” in all my projects and I was wondering what it is? Thanks for any help.
Arrg!!
Oluseyi
Oluseyi
The file stdafx.h is tied in to the use of pre-compiled headers, a process for speeding up compile times by precompiling a significant portion of the application code that hardly ever changes (say you include MFC sources in your application, or are developing a large static/dynamic link library but don''t want to have to suffer multiple-hour compile times for every single line change in one file). MSVC also creates the file stdafx.cpp to force compilation of stdafx.h (the cpp file generally only includes stdafx.h and contains no other code) since the IDE/compiler only permit compilation of source files.

You can stop MSVC from generating these files by unchecking "Use Precompiled Headers" while setting project type and other options, or go into Project->Settings->C/C++ and select "not using precompiled headers" or "automatic use of PCH".

PCHs are useful for large projects, but just a bother for smaller ones because stdafx.h must be the first file included in every source file in your project.
Abob
Abob
Thanks!
Arrg!!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.