How to use stdafx.h?

Feb 5, 2016 at 5:30pm
How do I use stdafx.h in VS in such a way that I can still also use iostream? I don't really want to use it since it'd reduce modularity and reusability in my code, but I still think that at least knowing how to use it might be good.
Feb 6, 2016 at 6:02am
@DragonOsman

You must have #include <stdafx.h> as the first line. Then put '#include <iostream> or any other includes you need. To stop needing to use #include <stdafx.h> in your VS code, go to the menu marked "PROJECT" and go to the bottom of the menu to the one that has your program name and the word 'properties' next to it. Click on it. Then click on 'Configuration Properties". Look down the list til you see the heading, "Precompiled Headers". Click on it. In the box on the right of this, you'll see where you can changed from 'Use' to 'Not Using Precompiled Headers'. You then don't need the #include <stdafx.h> at the beginning of your code. You must change this each time you create a new source code or change your code from debug to Release, when compiling.
Feb 6, 2016 at 5:12pm
@whitenite1

the stdfax.h header is in quotes, not in angle brackets.
Feb 6, 2016 at 5:30pm
@RUNNER PRO AGARIO

Yep, you're correct. It's been awhile since I've used the stdafx,h include file.
Feb 6, 2016 at 5:55pm
You're welcome!
Topic archived. No new replies allowed.