Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

a c compiler error

Options
  • 15-06-2006 7:47am
    #1
    Closed Accounts Posts: 1,829 ✭✭✭


    Guys, I'm trying to compile a simple enough c script on a HP UX box using gcc.
    I'm receiving the following error
    'incompatible implicit declaration of built-in function 'strlen' '

    The line in question simply reads cnt1=strlen(argv[1]);
    Any advice?
    JC


Comments

  • Registered Users Posts: 243 ✭✭Blinder


    Have you included the correct h file?
    #include <string.h>


  • Registered Users Posts: 6,508 ✭✭✭daymobrew


    Are you including strings.h? And what is argv declared as.
    Post more code.
    Useless sample of usage below:
    [PHP]#include <strings.h>

    int main(int argc, const char *argv[])
    {
    int cnt1;
    if ( argc >= 2 ) /* Gotta ensure there is an argv[1] to check. */
    cnt1 = strlen(argv[1]);

    return 0;
    }[/PHP]


  • Closed Accounts Posts: 1,829 ✭✭✭JackieChan


    Guys,
    thanks for your help.
    the problem was that string.h was not included.

    JC


Advertisement