VC Question

Alright, when you #include you use <> when it is default with the compiler and "" when it is not.

Why is the stdafx.h used with "" if its standard for VC?
VC generates a stdafx.h file and puts it in your project's directory, it's not a standard header file, it's generated automatically. Also, you can use quote marks with #include for files in the include path; quoted filenames tell the compiler (actually it's the pre-processor, which is often a separate program) to look in the directory of the source file first, and then the standard include path, whereas <> tells the compiler to look only in the standard include path. You can also tell the compiler to add some directory to the include path. I don't know how to do it with VC but with gcc and clang you pass -I<path> on the command-line to add <path> to the include path.
stdafx.h is not "std" in the sense of the C++ standard library, but it was chosen as the standard name by the MFC guys (see PS) for the header where they stick all the stuff that requires precompilation. It's uses has expanded to include non-MFC projects, too.

As chrisname said, as it's in the project folder, it needs to be #included with quotes.

Andy

PS Anything out of Microsoft with "afx" is usually associated with MFC

From: http://en.wikipedia.org/wiki/Application_Framework_eXtensions

One interesting quirk of MFC is the use of "Afx" as the prefix for many functions, macros and the standard precompiled header name "stdafx.h". During early development what became MFC was called "Application Framework Extensions" and abbreviated "Afx". The name Microsoft Foundation Classes (MFC) was adopted too late in the release cycle to change these references.
Topic archived. No new replies allowed.