Link to home
Start Free TrialLog in
Avatar of joannabanana
joannabanana

asked on

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

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.
Avatar of jkr
jkr
Flag of Germany image

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).
Avatar of joannabanana
joannabanana

ASKER

Yup I checked that, they're exactly the same :(
ASKER CERTIFIED SOLUTION
Avatar of jkr
jkr
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Is it possible that someone disabled "Precompiled headers" in debug mode?, but not in "Release" mode?
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