all.h looks like this:
#include <header1.h>
#include <header2.h>
#include <header3.h>
#include <header4.h>
When I include the all.h in my application:
#include "all.h"
I get an error that header1.h cannot be found. But if I change all.h to:
#include "header1.h"
#include "header2.h"
#include "header3.h"
#include "header4.h"
I works fine. But I don't want to change all.h, so how do I use all.h
unchanged (with <> instead of "")??
You have to check with your compiler!
The only difference is that "" tells the compiler to first look
somewhere (implementation specific) and, if not found there, perform
another search just like for <>.
Bo Persson
Short answer: add -Idir to your compilation options (or equivalent with
your IDE GUI).
Long answer: the standard doesn't define where included files (the "" form)
and headers (the <> form) are searched, excepted that if no file is found
an header is searched.
In practice, most compilers will search files included with ""
- in the same directory as the file containing the directive
- in a user specified list of directories
- in a list of default directories
while header included with <> are searched in the two last lists. But
there are variations on that which may break your build if you depend too
much on the search order to resolve ambiguities. And most compilers also
have other possibilities.
Yours,
--
Jean-Marc
>
>
> I works fine. But I don't want to change all.h, so how do I use all.h
> unchanged (with <> instead of "")??
You really should change it. The convention is that < ... > is for
system-supplied headers and " ... " is for everything else. That way
your users won't run into the problem you've just seen.
--
Pete
Roundhouse Consulting, Ltd. (www.versatilecoding.com) Author of "The
Standard C++ Library Extensions: a Tutorial and Reference
(www.petebecker.com/tr1book)