How GCC locates included files: Unterschied zwischen den Versionen

Aus PUCONwiki
Zur Navigation springen Zur Suche springen
Keine Bearbeitungszusammenfassung
Keine Bearbeitungszusammenfassung
Zeile 5: Zeile 5:
'''SO,''' one of the most asked questions in the interwebs about the C-compiler is: "where the hell does the C-compiler look for included files" (with more or less expletives included".
'''SO,''' one of the most asked questions in the interwebs about the C-compiler is: "where the hell does the C-compiler look for included files" (with more or less expletives included".


''THE ANSWER''' is (as usual): ''it depends ...''
'''THE ANSWER''' is (as usual): ''it depends ...''


As I was not really satisfied with what I could read, mainly because the concrete information was spread out all over the place, I'm trying to compile (sic!) the definitive information on the topic, but for one selected scenario:
As I was not really satisfied with what I could read, mainly because the concrete information was spread out all over the place, I'm trying to compile (sic!) the definitive information on the topic, but for one selected scenario:

Version vom 21. Mai 2020, 14:06 Uhr

It is a constantly raised issue: you write a C-program using a library. You #include "library_header.h" or #include <library_header.h>.

BUT: Not all is well: either your .h-file could not be found or another equally-named .h-file is included, ...

SO, one of the most asked questions in the interwebs about the C-compiler is: "where the hell does the C-compiler look for included files" (with more or less expletives included".

THE ANSWER is (as usual): it depends ...

As I was not really satisfied with what I could read, mainly because the concrete information was spread out all over the place, I'm trying to compile (sic!) the definitive information on the topic, but for one selected scenario:

  • the AVR-GCC compiler used in the Arduino 1.8.12 development environment, running on Microsoft Windows 10. This should eliminate the "it depends.." factor by nailing down all variations to a specific constellation.

Quote-Syntax versus Angle-Bracket-Syntax for #include

  • Quote-Syntax looks like: #include "library_header.h"
  • Angle-Bracket-Syntax looks like #include <library_header.h>