+ Reply to Thread
Results 1 to 4 of 4

Thread: gcc warnings: implicit declaration of function...

  1. #1
    utsiar
    Guest

    gcc warnings: implicit declaration of function...

    I am having strange warnings from gcc compiler, which I don't think should come while cmpiling.

    Can anyone help? The warnings are:

    - warning: implicit declaration of function 'bzero'

    - warning: implicit declaration of function 'inet_addr'



    The code is as below:



    int main(int argc, char **argv)

    {

    struct sockaddr_in servaddr;

    char buffer[BUFLEN];

    int n;



    argv0 = argv[0];



    if ( (sockfd=Socket(AF_INET,SOCK_STREAM,0)) < 0 )

    exit(1);



    bzero(&servaddr,sizeof(servaddr));

    servaddr.sin_family = AF_INET;



    if ( (servaddr.sin_addr.s_addr = inet_addr("131.170.24.42"))

    == -1 ) {

    fprintf(stderr,"%s : inet_addr failed, errno=%d\n",argv0,errno);

    exit(1);

    }



    .......

    .......

    }
    More Information:
    1. c:90: warning: incompatible implicit declaration of built-in function 'strncpy' gplot
    2. h:75: warning: implicit declaration of function 'ppm_writeppm' ppm_util
    3. From: Dan Kegel <dkegel at ixiacom dot com>; To: Bryce Schober <bryceman at dpzone dot com>; Cc: crossgcc at sources dot redhat dot com; Date: Thu, 02 Oct 2003 10:24:33 -0700; Subject: Re: OT: gcc warning: implicit declaration of function
    4. c:77: warning: implicit declaration of function `freeaddrinfo' You're probably not including the reqired headers
    5. If you later provide a declaration for the function which returns a type

    More:


  2. #2
    tupatydu
    Guest

    This I have figured out. I didn't include the header files for bzero(), inet_addr().



    Can anyone guide about the other warning?





    "void format, different type arg (arg 1)"



    The function's on which warning is given, looks like this:

    void fprint_stderr_sockarray(int* sockets)

    {

    ..........

    ..........

    }
    More Information:
    1. c:4: warning: incompatible implicit declaration of built-in function 'pow' With -Wall added, gcc becomes chattier: foo
    2. c:78: warning: incompatible implicit declaration of built-in function 'exit' gplot
    3. The following options control the amount and kinds of warnings produced by GCC; for further, language-specific options also refer to C++ Dialect Options
    4. c:5: warning: implicit declaration of function 'fileno' With: $ gcc --version gcc (GCC) 4
    5. warning: implicit declaration of function 'dgeev_' Packages/LinearAlgebra2/Src/lapack_litemodule
    6. 8 posts - 1 author - Last post: Apr 4implicit declaration of function 'ftruncate'
    7. c:3: warning: incompatible implicit declaration of built-in function ÔÇśprintfÔÇÖ tst
    8. implicit declaration of function, microsoft compiler, correct header: Hello Ajay
    9. 11 posts - 6 authors - Last post: Jul 15, 2008AVR GCC forum - Warning: implicit declaration of function?? SROSS - Jul 11, 2008 - 12:00 PM Post subject: Warning: implicit declaration of function?? Hi all, I'm sure this question has been asked many times
    10. 3 posts - 3 authors - Last post: Dec 17, 2009When compiling this program with gcc -ansi -pedantic -Wall I get the warning "implicit declaration of function `getopt'"

  3. #3
    themy8221
    Guest

    Sorry All,

    The warning comes on the inner line of this function. The line is:



    fprintf(stderr,

    " } at %p size %d\n",sockets,((MAX_TCPCLIENTS)*(sizeof(int))));



    The warning talks about argument 1, so there must be a problem with "sockets parameter", to let you people know sockets is an integer pointer: int* sockets this was sent to function as parameter.



    Now whats the problem, can someone tell me? Is this sockets some differetn type from "%p" or what? Btw, what does %p means in fprintf()?





    Waiting for response.
    More Information:
    1. c:250: warning: implicit declaration of function ‘strlcpy’ if gcc -DHAVE_CONFIG_H -I
    2. That implicit declaration remains in effect after the function call
    3. You can request many specific warnings with options beginning ` -W ', for example -Wimplicit to request warnings on implicit declarations
    4. c:1190: warning: implicit declaration of function 'lwline_remove_repeated_points' lwgeom
    5. 4 posts - 1 author - Last post: Oct 8, 2008[Bug c/37771] New: warning: implicit declaration of function 'fileno'
    6. 4: warning: implicit declaration of function 'wprintf' >> The problem is to debug a big source >> code

+ Reply to Thread

Similar Threads

  1. Tax declaration
    Can I host multiple blogs using same adsense acct, I mean I had 2 enter the URL of my site ... so how does it work for other sites , once I hav...
  2. what the line spacing declaration?
    what the declatation property to space out lines? i know in microsoft its line spacing but idk what its called in css and i need to seperate my list...
  3. Declaration Of Google Adsense Independence!
    Hey All! I hereby, declare that I have removed all adsense codes from half of my sites, and have placed a new sponsor, ( a smaller...
  4. Global CSS declaration for "a" (i. e. "a href") tag
    I have style definitions that look like this: Code: .a10b, .a10b a:link, .a10b a:visited, .a10b a:hover { font: 10px Arial;
  5. Implicit login in AIX
    only wanted to know .. if I have some tivoli jobs running with different user .. will this mean that everytime the job invokes .. the .profile runs...

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Automatic Translations (Powered by Powered by Google):
Afrikaans Albanian Arabic Belarusian Bulgarian Catalan Chinese Croatian Czech Danish Dutch English Estonian Filipino Finnish French Galician German Greek Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Taiwanese Thai Turkish Ukrainian Vietnamese Welsh Yiddish