Question

I compile an example.c file that has the line:

#include "parse/properties/properties.h"

The compiler creates get an example.o file. Is the path to the header file included in the example.o file? or is that information external?

Was it helpful?

Solution

It may or may not, the object file format is not standardised (the standard does not even mention "object files"). A compiler might insert the #include for debugging purposes, or it may skip it completely.

Note also that #include'ing is done by the compiler in what the standard desrcibes as the first phase in translation, using a textual preprocessor; the #include-directive tells the preprocessor to copy verbatim and inplace the contents of another file. This happens long before actual object files would be produced

OTHER TIPS

It is implementation defined but generally when you compile with debugging options ( eg -g in gcc ) the file paths are included to aid you in debugging

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