I have a header file that I am trying to include from another source file using the include pre-processor directory. I tried to use both the quotation mark shape and the angular shape shape, but none of them do the job.
The file name .>"hello.h and the directory in which the compiler searches. I tried to include it like this:
#include <.>"hello.h>#include <.\>"hello.h>#include <.\>\"hello.h>#include ".>"hello.h"#include ".>\"hello.h"
I also tried different C and C ++ compilers - clang, gcc, clang ++ and g ++.
Obviously, none of the above actions were, or otherwise there would be no doubt.
I thought that perhaps the name is not legal according to the standard. Unfortunately, I have neither C nor standard C ++ specifications. The only authoritative source of information I could find was this MSDN page about the #include directive and the GNU C preprocessor documentation, here . The GNU documentation says little; MSDN has the following sentence:
A path specification is the name of a file that is not necessarily preceded by a specification directory. The file name must contain the name of the existing file. The syntax of the path specification depends on the operating system on which the program is compiled.
I am curious what is being said about this C and about C ++ standards?
Where can I find those OS-specific rules for C and C ++ header naming requirements? I'm particularly interested in OS X, Linux, and FreeBSD.
Why doesn't escaping < and / or " characters work?
How to include a file?
c ++ c include c-preprocessor
user405725
source share