header/include files and compilers

Ask a Question related to UNIX Programming, Design and Development.

  1. #1

    Default header/include files and compilers

    Hi everyone,

    When writing a program (say, work.c), I could simply include header
    files using, for example:
    #include <stdio.h>

    and "gcc work.c" would compile no problem.

    For the compiler such as gcc, how does it know where to find that
    include file, without even having to specify paths to search using -I ?
    I'd certainly think it has internally included (default) path to
    /usr/include/ ? It also seems to be the case for arm-linu-gcc (cross
    compiler for arm processor). What if I do not want use those header
    files in my native system but the others (ie. the ones that come with
    arm cross compiler package)?

    In addition, if two included paths both contain the header needed (same
    name but not necessary the same content). Which one does a compiler choose?

    I never have understood this concept until recent I started working with
    different compiler for different platform which has its own libraries
    and different versions of linux kernels. And I'd get confused with
    different versions of header files in my system.

    I'd really appreciate if anyone could answer these questions for me.
    Thanks alot!

    Johnny

    Johnny Shih Guest

  2. Similar Questions and Discussions

    1. intel compilers
      Has anyone tried install intel's compilers on 6.04? My 'replacement headers' install, but the compiler fails to install. There is No error...
    2. how do I hide database connection files using PHP include files?
      I have the following at the beginning of the PHP page: <?php require_once('Connections/conn.php'); ?> I want to hide the connection file,...
    3. Differences is using netdb.h with the cc and gcc compilers.
      I have a small 'C' program that wraps up the netdb.h headers on multiple platforms. The AIX version of this code compiles beautifully using the...
    4. include and imagejpg() weird behavior - maybe header?
      I have a function that resizes images. If I put it in the same php file that calles it it workes fine. Gives a nice thumbnail or whatever size I...
    5. include() header and footer
      I'm ashamed that I need to ask this question. I've been using PHP for almost a year now, and have used HTML extensively in the last few years. ...
  3. #2

    Default Re: header/include files and compilers

    Johnny Shih wrote:
    > Hi everyone,
    >
    > When writing a program (say, work.c), I could simply include header
    > files using, for example:
    > #include <stdio.h>
    >
    > and "gcc work.c" would compile no problem.
    >
    > For the compiler such as gcc, how does it know where to find that
    > include file, without even having to specify paths to search using -I ?
    > I'd certainly think it has internally included (default) path to
    > /usr/include/ ? It also seems to be the case for arm-linu-gcc (cross
    > compiler for arm processor). What if I do not want use those header
    > files in my native system but the others (ie. the ones that come with
    > arm cross compiler package)?
    >
    > In addition, if two included paths both contain the header needed (same
    > name but not necessary the same content). Which one does a compiler choose?
    >
    > I never have understood this concept until recent I started working with
    > different compiler for different platform which has its own libraries
    > and different versions of linux kernels. And I'd get confused with
    > different versions of header files in my system.
    >
    > I'd really appreciate if anyone could answer these questions for me.
    > Thanks alot!
    >
    Sure. If your using a flavor of gcc, do a `gcc -v'. The output will refer
    to a `specs' file that will contain all such information.

    HTH,
    --ag


    --
    Artie Gold -- Austin, Texas



    ----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
    [url]http://www.newsfeed.com[/url] The #1 Newsgroup Service in the World! >100,000 Newsgroups
    ---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
    Artie Gold Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139