0

Is there a way to use pre-compiled headers in VC++ without requiring stdafx.h?

Regarding the first answer to this question above,

I tried to implement his solution using visual studio 2010, and failed:

fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "StdAfx.h"' to your source?

Any ideas?

The objective is to NOT use #include "StdAfx.h" anywhere, but instead decide on whether or not to use it during compile time.

If /Yc or Yu are not used, #pragma hdrstop has no effect

If /Yu is used, #pragma hdrstop is replaced with #include "StdAfx.h", or at least thats the claimed behavior.

Engineero
  • 12,340
  • 5
  • 53
  • 75
aCuria
  • 6,935
  • 14
  • 53
  • 89

1 Answers1

1

The error message indicates that you had option /Yu "StdAfx.h" when compiling. The answer suggested to leave that "StdAfx.h" part of /Yu option blank.

Öö Tiib
  • 10,809
  • 25
  • 44