How GCC locates included files: Unterschied zwischen den Versionen

Aus PUCONwiki
Zur Navigation springen Zur Suche springen
(Die Seite wurde neu angelegt: „It is a constantly raised issue: you write a C-program using a library. You <code>#include "library_header.h"</code> or <code>#include <library_header.h>…“)
 
Keine Bearbeitungszusammenfassung
Zeile 1: Zeile 1:
It is a constantly raised issue: you write a C-program using a library. You <code>#include "library_header.h"</code> or <code>#include &lt;library_header.h&gt;</code>. BUT: Not all is well: either your .h-file could not be found or another equally-named .h-file is included, ...
It is a constantly raised issue: you write a C-program using a library. You <code>#include "library_header.h"</code> or <code>#include &lt;library_header.h&gt;</code>.  


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".
'''BUT:''' Not all is well: either your .h-file could not be found or another equally-named .h-file is included, ...


The answer is (as usual): ''it depends ...''
'''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:
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>