We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

Debug vs Release mode - Cannot open include file: 'stdafx.h'

Medium Priority
1,221 Views
Last Modified: 2013-12-14
I have a fairly complex application which compiles fine in Debug mode (in Visual Studio .NET) but when I switch to Release mode I get the error:
fatal error C1083: Cannot open include file: 'stdafx.h': No such file or directory

The #include "stdafx.h" that this error refers to is from a file that was developed outside my project (ie. I added the .cpp and .h file, but not its corresponding stdafx.h - because I have my own.)

I don't understand why it would compile in Debug but not in Release.
Comment
Watch Question

jkr
CERTIFIED EXPERT
Top Expert 2012

Commented:
Under your project settings, check whether your Debug and Release configurations are different in "Additional Include Directories" and make sure that these entries are the same (if applicable).

Author

Commented:
Yup I checked that, they're exactly the same :(
CERTIFIED EXPERT
Top Expert 2012
Commented:
Can you check with FileMon (http://www.microsoft.com/technet/sysinternals/FileAndDisk/Filemon.mspx) where the compiler is looking for that file in both cases?

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Is it possible that someone disabled "Precompiled headers" in debug mode?, but not in "Release" mode?

Author

Commented:
All the settings for the project seem to be the same for Debug and Release.

I have now noticed, however, that I only get the error if I try to "Build" the solution but if I click "Start" (debugging), it asks me if I want to build the solution (as it is not up to date), I click Yes, and it builds and runs ok.
Can anyone explain to me why this is so? I am fairly new to this and am getting a serious "crash course" (literally! lol).
Thanks
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.