Thread: Include files in subdirectory of /usr/include doest append during compile

  1. #1
    Registered User
    Join Date
    Nov 2011
    Posts
    1

    Include files in subdirectory of /usr/include doest append during compile

    Helllo all,

    i would like to ask you for help with the next problem:

    What is wrong with my settings?
    I got Gentoo, gcc 4.5.3, binary compile after update world.

    My header files are locating in /usr/include. But also there are a lot of other subdirectories with headers file like libdjvu, alsa, asm .. etc.
    And when i write in example.c-file line like #include <ptrace.h> which is located in /usr/include/asm dir, compiler get me an error:
    fatal error: ptrace.h: No such file or directory

    I suppose that i can solve partialy this problem by creating Makefile with right statements or passing parametre -I to gcc.

    My problem is that before i update whole system, i can use header files from any subdirectories i want. Now , after update i cannot do it.

    Please tell me, is there some setting where i could set that gcc has to searching for header files over whole /usr/include directory, with subdirectory

    I hope i am clear with the description of my problem.

    Thank you for any ideas

    Bests ')

  2. #2
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    You can use relative paths in #include, eg:

    Code:
    #include <sys/stat.h>
    #include <asm/ptrace.h>
    However, I think the correct include for ptrace is actually <sys/ptrace.h> -- if you look at that, there is a chain of includes that will eventually lead to the file in asm/

    If you cd into /usr/include and do this

    grep -r ptrace.h ./

    you'll find some clues about how this tree works.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. multiple include doesn't give compile error
    By jeanluca in forum C Programming
    Replies: 2
    Last Post: 04-20-2010, 05:46 AM
  2. multiple include of header file gives compile errors
    By jeanluca in forum C Programming
    Replies: 5
    Last Post: 04-16-2010, 02:36 PM
  3. Include Compile Info
    By rkensparc in forum C Programming
    Replies: 1
    Last Post: 08-02-2007, 09:38 AM
  4. What libnet libraries to include with compile?
    By failure_to in forum C Programming
    Replies: 3
    Last Post: 06-16-2004, 06:42 AM
  5. Include in compile
    By nomes in forum C Programming
    Replies: 1
    Last Post: 10-10-2003, 10:57 PM

Tags for this Thread