Find the answer to your Linux question:
Results 1 to 5 of 5
Hi, I am just starting to resume my programming - so have come to the world of Linux because its great. Anyway, i have a C file i am trying ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Oct 2005
    Location
    Cambridge, UK
    Posts
    7

    Searching for function definitions in kernel header files


    Hi,

    I am just starting to resume my programming - so have come to the world of Linux because its great.

    Anyway, i have a C file i am trying to compile and it contains includes for headers...

    Code:
    #include <string.h>
    #include <stdlib.h>
    #include <time.h>
    #include <sys/resource.h>
    #include <unistd.h>
    Also, its giving me an error because i havent included the header declaration for a function perror() and also printf(). I want to search the header files for these function declerations so i can include them.

    My question is, where are these files located - or do i have to go and get them from somewhere ? I have done a find for these files but cant find them!

    Thanks in advance

    Ringo

    PS I have just installed mandrake 10.1

  2. #2
    Linux Newbie
    Join Date
    Oct 2004
    Posts
    158
    You may have not installed it correctly. Several things are not correct.

    printf() is in <stdio.h> But - it does not have to be declared as a function
    prototype - per standard C99. Your code should compile anyway.

    perror() is in <stdlib.h> which you included.

    Are you sure you're not seeing link errors instead? Are you in an ARM environment?

    1. show us your gcc command line

    2. give us all the screen output from gcc

  3. #3
    Just Joined!
    Join Date
    Oct 2005
    Location
    Cambridge, UK
    Posts
    7
    You may recognise this jim....
    Code:
    gcc -Wall revtest.c -o revtest
    revtest.c&#58; In function `main'&#58;
    revtest.c&#58;108&#58; warning&#58; implicit declaration of function `perror'
    revtest.c&#58;114&#58; warning&#58; implicit declaration of function `printf'
    Pretty simple - do i need to set my path up correctly ?

    Thanks

    Ringo

  4. #4
    Just Joined!
    Join Date
    Oct 2005
    Location
    Cambridge, UK
    Posts
    7
    Should these files be in or around /usr/src/linux ?

    Because they arent!

    Thanks

    Ringo

  5. #5
    Linux User
    Join Date
    Jul 2004
    Location
    Poland
    Posts
    368
    Quote Originally Posted by ringo22
    Should these files be in or around /usr/src/linux ?

    Because they arent!

    Thanks

    Ringo
    They should reside in /usr/include. Do you have something like glibc-devel package installed? But I think these files are there, otherewise the C preprocessor would complain.
    "I don't know what I'm running from
    And I don't know where I'm running to
    There's something deep and strange inside of me I see"

Posting Permissions

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