What is the difference between:
#include "xyz.h"
and
#include <xyz.h>
And how do you call them?
Thanks.
What is the difference between:
#include "xyz.h"
and
#include <xyz.h>
And how do you call them?
Thanks.
#include "..."
Includes a file in the current directory (or looks there first then moves to the compilers' include directory).
#include <...>
Includes a file from wherever the compiler is set-up to include headers from. If it can't be found it's searched for in the current directory.
I'm not sure if the searching elsewhere is compiler specific, but a quick browse of the C standard would clear that up if you're interested.
The former is generally used for user defined header files while the latter is usually used for standard headers, or those of libraries that you install into the compiler's include directory.
The compiler usually searches for the former ("xyz.h") with respect to the current directory and whatever other include directories are specified (or if it still cannot find a matching file, it will then search as if it was the latter), but will look for the latter (<xyz.h>) in its own include directory.
Of course, the details of how the search for a matching header is conducted is implementation dependent (except for that fallback from "xyz.h" to <xyz.h>, which is guaranteed), but that is the general idea.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
Thanks