Question

Possible Duplicate:
What is the difference between #include <filename> and #include “filename”?
include “file.h” vs <file> what is the difference?

I've encountered this a couple of times when using external libraries and I assume that this is purely because of my inexperience. My question as the title says is what is the difference between using <> in an include and "", its clearly a big one as you can't include your own headers with <> but you can with "" and vice versa you can't include headers such as <string> with "".

I'm using the Crystal Space SDK at the moment and I'm working my way through getting to grips with it and following the tutorials. I was following the Creating-External-MSVC-Application Howto guide and encountered this error:

1>------ Build started: Project: NewDawn, Configuration: Debug Win32 ------
1>  simple1.cpp
1>f:\project\newdawn\newdawn\include\cs\csplatform.h(26): fatal error C1083: Cannot open include file: 'csutil/win32/csconfig-msvc.h': No such file or directory
1>  main.cpp
1>f:\project\newdawn\newdawn\include\cs\csplatform.h(26): fatal error C1083: Cannot open include file: 'csutil/win32/csconfig-msvc.h': No such file or directory
1>  Generating Code...
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

I went and found the file csplatform.h and found that it included the file csconfig-msvc.h using < >:

#if defined (CS_WIN32_CSCONFIG)
/* Use manually maintained settings when not building on environments not
* using configure (specifically, MSVC) */
#  include <csutil/win32/csconfig-msvc.h>
#else
#  include <csconfig.h>
#endif

I could theoretically change the #include csutil/win32/csconfig-msvc.h from < > to " " but I shouldn't have to do that, this is a well established Code Library and the simplest tutorial should work straight out the box.

I want to know why it does it with < > and not " ". I seen Boost do it as well if I remember right.

Was it helpful?

Solution

#include <some file> uses the include search path. #include "some file" is relative to the file being compiled. So if you want to use #include <some file> you need to modify the include search path.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top