Why precompiled header needs an source file too?

hi,
I know this question sound stupid but it's also stupid that visual studio 2010 creates an stdAfx.cpp file when selecting "precompiled header" option.

heders is created to include other headers into it but why would anyone need stdAfx.cpp?

thanks.
Last edited on
It's an inconvenience designed to make your life harder. ;)
stdafx.cpp is the translation unit that actually creates the precompiled header. Without it, the compiler wouldn't be able to notice changes made to stdafx.h, so it would have to recompile it every time, defeating its purpose.
thanks for clarifing this!

EIDT:
is it OK to put some code into stdAfx.cpp file?

if not why not.
Last edited on
Topic archived. No new replies allowed.