Sign in to follow this  
dwmitch

Cannot find stdafx.h

Recommended Posts

When I try to compile a program that uses stdafx.h I always get an error. I've searched for it on my system, then linked to every folder that contains it, but it didn't fix the problem. Any suggestions, other than uninstalling visual studio and throwing the computer out the window?

Share this post


Link to post
Share on other sites
where/how are you telling it to look for the files? you should have the directory in your project properties-> C/C++ -> general -> Additional Include Directories

-me

Share this post


Link to post
Share on other sites
I have it linked under the directories tab under Tools->Options.

The example file I tried compiling is read only, so I assumed everything would be set there, since it can't be altered without removing the read only status.

Share this post


Link to post
Share on other sites
stdafx.h is a precompiled header. The project you tried to compile isn't setup for using a PCH but yet the files include the PCH file. Try commenting out all #include "stdafx.h" and recompile.

Toolmaker

Share this post


Link to post
Share on other sites
I created a new project and just used quotations on stdafx.h. I can't alter the example program because it's read only.

How do I set it up to use PCHs?

Share this post


Link to post
Share on other sites
Quote:
Original post by dwmitch
I created a new project and just used quotations on stdafx.h. I can't alter the example program because it's read only.


er... so you can copy it or make it not read-only... right-click the file in explorer -> properties -> uncheck read-only

-me

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this