0

I haven’t written much C code, but for a Lua based library I am writing to interface with Harfbuzz, I needed to write some C code.

My question is about the syntax to include header files in C. I have seen three different variants in other C code that uses Harfbuzz

Variant 1

#include <hb.h>

Variant 2

#include "hb.h"

Variant 3

#include "harfbuzz/hb.h"

My question is – what is the most appropriate/correct/cross-compatible way to specify header files, when I am writing C code.

Nicol Bolas
  • 449,505
  • 63
  • 781
  • 982
vyom
  • 249
  • 3
  • 10
  • 2
    did you search SO? this post will teach you about variant 1 and 2: http://stackoverflow.com/questions/21593/what-is-the-difference-between-include-filename-and-include-filename – smertrios Dec 04 '15 at 02:40
  • personally, I try to avoid variant 3 and only use it for internal dependencies that I have full control over. Such code is always distributed as a whole since header dependency is captured in the header files (vs. configuring the toolchain search paths) – smertrios Dec 04 '15 at 02:54
  • Thanks, I was really confused about Variant 3. But the answer you linked to does clarify things. So I have accepted the question as a duplicate. – vyom Dec 04 '15 at 02:56
  • #include This form is used for system header files. It searches for a file named 'file' in a standard list of system directories. You can prepend directories to this list with the -I option while compiling your source code. – Shrikant Gawali Dec 04 '15 at 04:07

0 Answers0