Thread: C: include files problem

  1. #1
    template<typename T> threahdead's Avatar
    Join Date
    Sep 2002
    Posts
    214

    C: include files problem

    hello,

    i have been trying to get some basic code working.
    its some piece of userspace code that does have problems
    with including the correct files when doing the preprocessing.

    for example i have:

    Code:
    #include <linux/module.h>
    on preprocessing, the standard directory is asked for that file, that is /usr/include/* for my machine.
    the problem is that the files in that directory are very old, as they are left from the install when kernel 2.4.18 was
    current.
    i am using a 2.6 kernel now.
    further on i am trying to access elements in structs for example
    that only exist since 2.6 kernel series.
    but as the preprocessor asks /usr/include/*, i am getting:

    Code:
    file.c: In function `main':
    file.c:100: error: structure has no member named `core_size'
    in this file.c i am trying to access an element of the struct module of the 2.6 kernels.
    but as the preprocessor is referring to the old includes,
    that element obviously doesnt exist.

    now:
    how can i update my header include files to prevent
    version confusion?
    or how is it possible to redirect every #include to the
    current kernel source tree includes?
    i tried gcc -I and -L options with the current kernel source tree includes with no success and even more errors.

    thanks for your time!
    threadhead

  2. #2
    Registered User loopy's Avatar
    Join Date
    Mar 2002
    Posts
    172
    Hello!

    Depending on you newer kernel installation directory, mine is always my users home, you could try to make a symlink from old source directory to new, if I have it installed in my user account home dir '/home/stratus' I could do:

    Code:
    [EnGlow][root][07:42:14][/usr/src][#] rm /usr/src/linux
    Then, create a new symlink to the new directory containing the sources:

    Code:
    [EnGlow][root][07:42:14][/usr/src][#] ln -s /home/stratus/linux-2.6.3 ./linux
    Which gives me:

    Code:
    [EnGlow][root][07:42:14][/usr/src][#] ls
    2.4.22.nat.diff  linux@  linux-2.4.22/  rpm/  xfs-2.4.22/
    [EnGlow][root][07:42:15][/usr/src][#] 
    [EnGlow][root][07:42:15][/usr/src][#] readlink ./linux
    /home/stratus/linux-2.6.3
    [EnGlow][root][07:44:41][/usr/src][#]
    HTH
    Last edited by loopy; 05-05-2004 at 06:46 PM.

  3. #3
    Registered User
    Join Date
    May 2004
    Posts
    3

    Thumbs up

    Try using the force option combined with symlink option !!

    regards,
    karthik bala guru

  4. #4
    Registered User loopy's Avatar
    Join Date
    Mar 2002
    Posts
    172
    Quote Originally Posted by linladen
    Try using the force option combined with symlink option !! :)

    regards,
    karthik bala guru :cool:
    Ok, LOL, *DON"T* do that, 'man ln' will tell you why.

    {edit}

    I guess that option saves a step, removing the old symlink.

    :D
    Last edited by loopy; 05-06-2004 at 07:37 AM.

  5. #5
    template<typename T> threahdead's Avatar
    Join Date
    Sep 2002
    Posts
    214
    i made it work another way.
    just copied the newer kernel header to the old location
    and made it work myself.

    thanks anyway

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. uniting all .h files in an include folder
    By afflictedd2 in forum C++ Programming
    Replies: 8
    Last Post: 11-26-2008, 01:36 PM
  2. Multiple Source Files, make files, scope, include
    By thetinman in forum C++ Programming
    Replies: 13
    Last Post: 11-05-2008, 11:37 PM
  3. Read and write hanging
    By zee in forum C Programming
    Replies: 8
    Last Post: 08-03-2004, 11:19 PM
  4. problem closing socket
    By Wisefool in forum Networking/Device Communication
    Replies: 2
    Last Post: 10-29-2003, 12:19 PM
  5. problem with connecting to my own machine
    By EvBladeRunnervE in forum Networking/Device Communication
    Replies: 10
    Last Post: 07-24-2003, 04:16 PM