Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

6
  • 3
    Glad to see this answer here. Another point worth mentioning would be that when you have many ".c" source files, it's necessary to specify each and every one of them in the commandline itself. You can't just do something like a -I to specify that all source files are in a certain directory. Commented Sep 6, 2011 at 6:20
  • 4
    If the header is in the same directory as the source, do you need a special include? I can't get my code to compile either way, and I'm not sure what the problem is Commented Dec 8, 2013 at 16:46
  • 1
    According to this answer to a similar question, gcc would not search the subdirectories for the different header files automatically. Instead, pkg-config could produce the proper -I option? Commented Sep 25, 2017 at 14:38
  • 1
    What's the difference between -I and -L? Commented Oct 15, 2018 at 0:31
  • 1
    @EdwinPratt Perhaps you meant to say that -L tells GCC where to look for binary libraries to include (which are specified with -l). And -I tells GCC where to look for header files to include. Commented Mar 31, 2020 at 11:58