implicit declaration of function???

Discussion in 'C Programming' started by yeah, Sep 14, 2007.

  1. yeah

    yeah Guest

    hi
    I got this error "implicit declaration of function"
    what it means???
    yeah, Sep 14, 2007
    #1
    1. Advertising

  2. yeah said:

    > hi
    > I got this error "implicit declaration of function"
    > what it means???


    You forgot to provide a prototype for a function within the scope
    visible to the compiler at the point where it was compiling a call to
    that function.

    If it's a standard library function or a function from a third party
    library (or indeed from your own library), include the appropriate
    header.

    If it's one of your own functions, copy the declarator to near the top
    of the program, and bang a semicolon on the end of it. That should fix
    the problem.

    --
    Richard Heathfield <http://www.cpax.org.uk>
    Email: -www. +rjh@
    Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
    "Usenet is a strange place" - dmr 29 July 1999
    Richard Heathfield, Sep 14, 2007
    #2
    1. Advertising

  3. yeah

    yeah Guest

    On Sep 14, 6:04 pm, Richard Heathfield <> wrote:
    > yeah said:
    >
    > > hi
    > > I got this error "implicit declaration of function"
    > > what it means???

    >
    > You forgot to provide a prototype for a function within the scope
    > visible to the compiler at the point where it was compiling a call to
    > that function.
    >
    > If it's a standard library function or a function from a third party
    > library (or indeed from your own library), include the appropriate
    > header.
    >
    > If it's one of your own functions, copy the declarator to near the top
    > of the program, and bang a semicolon on the end of it. That should fix
    > the problem.
    >
    > --
    > Richard Heathfield <http://www.cpax.org.uk>
    > Email: -www. +rjh@
    > Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
    > "Usenet is a strange place" - dmr 29 July 1999


    thanks
    The prototype for certain functions are missing in the header files.
    Is it possible to download the particular functions from net and add
    it to the program?
    yeah, Sep 14, 2007
    #3
  4. "yeah" <> schrieb im Newsbeitrag
    news:...
    > The prototype for certain functions are missing in the header files.
    > Is it possible to download the particular functions from net and add
    > it to the program?

    A function is not the same as a prototype, a prototype merly describes (a
    part of) the interface of a funtion (i.e. it's in- and output types).
    A prototype (in some header) is useless without the function (in some
    libary). If enough documentation is provided with the function/library, you
    may be able to create the prototype yourself, otherwise the function/libray
    is useless, complain to the vendor

    Downloading one or the other from the net won't help, you need both and they
    need to match

    Bye, Jojo
    Joachim Schmitz, Sep 14, 2007
    #4
  5. "Richard Heathfield" <> schrieb im Newsbeitrag
    news:...
    > yeah said:

    What's up, your gmail filter broke? :cool:

    Bye, Jojo
    Joachim Schmitz, Sep 14, 2007
    #5
  6. yeah

    yeah Guest

    On Sep 14, 6:46 pm, "Joachim Schmitz" <>
    wrote:
    > "yeah" <> schrieb im Newsbeitragnews:...> The prototype for certain functions are missing in the header files.
    > > Is it possible to download the particular functions from net and add
    > > it to the program?

    >
    > A function is not the same as a prototype, a prototype merly describes (a
    > part of) the interface of a funtion (i.e. it's in- and output types).
    > A prototype (in some header) is useless without the function (in some
    > libary). If enough documentation is provided with the function/library, you
    > may be able to create the prototype yourself, otherwise the function/libray
    > is useless, complain to the vendor
    >
    > Downloading one or the other from the net won't help, you need both and they
    > need to match
    >
    > Bye, Jojo


    ok.
    and i am also getting error like for example

    WARNING: "i2c_attach_client" [/work/uclinux/uClinux-dist/linux-2.6.x/
    drivers/video/chumma/bfin_adv7393fb.ko] undefined!

    but the <i2c.h> is included in the main program.The i2c.h contains

    "extern int i2c_attach_client(struct i2c_client *);"

    and also has written the function i2c_client.
    but i dont understand why this error comes..
    yeah, Sep 14, 2007
    #6
  7. yeah

    CBFalconer Guest

    Richard Heathfield wrote:
    > yeah said:
    >
    >> I got this error "implicit declaration of function"
    >> what it means???

    >
    > You forgot to provide a prototype for a function within the scope
    > visible to the compiler at the point where it was compiling a call
    > to that function.
    >
    > If it's a standard library function or a function from a third
    > party library (or indeed from your own library), include the
    > appropriate header.
    >
    > If it's one of your own functions, copy the declarator to near the
    > top of the program, and bang a semicolon on the end of it. That
    > should fix the problem.


    Or, better, just move the whole function definition up ahead of the
    first call to it. No duplications left to keep synced.

    --
    Chuck F (cbfalconer at maineline dot net)
    Available for consulting/temporary embedded and systems.
    <http://cbfalconer.home.att.net>


    --
    Posted via a free Usenet account from http://www.teranews.com
    CBFalconer, Sep 14, 2007
    #7
  8. Joachim Schmitz said:

    > "Richard Heathfield" <> schrieb im Newsbeitrag
    > news:...
    >> yeah said:

    > What's up, your gmail filter broke? :cool:


    Kind of. I'd removed the "killfile on" filter so that I could analyse a
    thread elseUsenet, and forgot to restore it. This happens occasionally.
    :) (Also, *some* gmail users have been modded up. Not many, but I
    think I've got most of the regular clueful gmailers for clc, anyway.)

    Anyway, it's back on now. :)

    --
    Richard Heathfield <http://www.cpax.org.uk>
    Email: -www. +rjh@
    Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
    "Usenet is a strange place" - dmr 29 July 1999
    Richard Heathfield, Sep 14, 2007
    #8
  9. "yeah" <> schrieb im Newsbeitrag
    news:...
    > On Sep 14, 6:46 pm, "Joachim Schmitz" <>
    > wrote:
    >> "yeah" <> schrieb im
    >> Newsbeitragnews:...>
    >> The prototype for certain functions are missing in the header files.
    >> > Is it possible to download the particular functions from net and add
    >> > it to the program?

    >>
    >> A function is not the same as a prototype, a prototype merly describes (a
    >> part of) the interface of a funtion (i.e. it's in- and output types).
    >> A prototype (in some header) is useless without the function (in some
    >> libary). If enough documentation is provided with the function/library,
    >> you
    >> may be able to create the prototype yourself, otherwise the
    >> function/libray
    >> is useless, complain to the vendor
    >>
    >> Downloading one or the other from the net won't help, you need both and
    >> they
    >> need to match
    >>
    >> Bye, Jojo

    >
    > ok.
    > and i am also getting error like for example
    >
    > WARNING: "i2c_attach_client" [/work/uclinux/uClinux-dist/linux-2.6.x/
    > drivers/video/chumma/bfin_adv7393fb.ko] undefined!
    >
    > but the <i2c.h> is included in the main program.The i2c.h contains
    >
    > "extern int i2c_attach_client(struct i2c_client *);"

    Take a closer look at i2c.h, check whether that prototype is visible to your
    translation unit (the .c that uses #include "i2c.h"), there could well be
    some #if or #ifdef preventing that.

    > and also has written the function i2c_client.
    > but i dont understand why this error comes..

    This may be beond the scope of comp.lang.c, maybe you look in some linux or
    i2c (whatever that is) related newsgroups.

    Bye, Jojo
    Joachim Schmitz, Sep 14, 2007
    #9
  10. yeah

    CBFalconer Guest

    yeah wrote:
    >

    .... snip ...
    >
    > and i am also getting error like for example
    >
    > WARNING: "i2c_attach_client" [/work/uclinux/uClinux-dist/
    > linux-2.6.x/drivers/video/chumma/bfin_adv7393fb.ko] undefined!
    >
    > but the <i2c.h> is included in the main program.The i2c.h contains
    >
    > "extern int i2c_attach_client(struct i2c_client *);"
    >
    > and also has written the function i2c_client.
    > but i dont understand why this error comes..


    Where is the .c file that the i2c.h file allows your source to
    connect to? Does that file contain a proper definition of the
    i2c_client function? If so, are you linking its object file into
    your final program? Maybe the i2c.h file defines things in a
    library, if so have you told the compiler to link to that library?

    --
    Chuck F (cbfalconer at maineline dot net)
    Available for consulting/temporary embedded and systems.
    <http://cbfalconer.home.att.net>



    --
    Posted via a free Usenet account from http://www.teranews.com
    CBFalconer, Sep 14, 2007
    #10
  11. On Fri, 14 Sep 2007 07:01:15 -0700, yeah <> wrote:

    >On Sep 14, 6:46 pm, "Joachim Schmitz" <>
    >wrote:
    >> "yeah" <> schrieb im Newsbeitragnews:...> The prototype for certain functions are missing in the header files.
    >> > Is it possible to download the particular functions from net and add
    >> > it to the program?

    >>
    >> A function is not the same as a prototype, a prototype merly describes (a
    >> part of) the interface of a funtion (i.e. it's in- and output types).
    >> A prototype (in some header) is useless without the function (in some
    >> libary). If enough documentation is provided with the function/library, you
    >> may be able to create the prototype yourself, otherwise the function/libray
    >> is useless, complain to the vendor
    >>
    >> Downloading one or the other from the net won't help, you need both and they
    >> need to match
    >>
    >> Bye, Jojo

    >
    > ok.
    >and i am also getting error like for example
    >
    >WARNING: "i2c_attach_client" [/work/uclinux/uClinux-dist/linux-2.6.x/
    >drivers/video/chumma/bfin_adv7393fb.ko] undefined!
    >
    >but the <i2c.h> is included in the main program.The i2c.h contains
    >
    >"extern int i2c_attach_client(struct i2c_client *);"
    >
    >and also has written the function i2c_client.
    >but i dont understand why this error comes..


    Is the diagnostic message from the compiler or the linker? If it is
    from the linker, then your problem is you didn't tell the linker in
    which library it could find the function.


    Remove del for email
    Barry Schwarz, Sep 14, 2007
    #11
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jason
    Replies:
    3
    Views:
    11,904
    Thomas Mang
    Jan 1, 2004
  2. nick
    Replies:
    2
    Views:
    672
    Martin Ambuhl
    Oct 16, 2005
  3. Paminu
    Replies:
    7
    Views:
    2,391
    FlyingBird
    Feb 7, 2006
  4. Johs32
    Replies:
    6
    Views:
    1,284
    Mark McIntyre
    Mar 31, 2006
  5. DanielJohnson

    error: implicit declaration of function `func_name'

    DanielJohnson, Jun 17, 2008, in forum: C Programming
    Replies:
    5
    Views:
    11,067
    rahul
    Jun 18, 2008
Loading...

Share This Page