?
Solved

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

Posted on 2007-07-19
5
Medium Priority
?
747 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.
0
Comment
Question by:joannabanana
  • 2
  • 2
5 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 19526000
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).
0
 

Author Comment

by:joannabanana
ID: 19526039
Yup I checked that, they're exactly the same :(
0
 
LVL 86

Accepted Solution

by:
jkr earned 750 total points
ID: 19526083
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?
0
 
LVL 8

Expert Comment

by:Anthony2000
ID: 19528086
Is it possible that someone disabled "Precompiled headers" in debug mode?, but not in "Release" mode?
0
 

Author Comment

by:joannabanana
ID: 19577593
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
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
Suggested Courses

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question