Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

a c compiler error

  • 15-06-2006 07:47AM
    #1
    Closed Accounts Posts: 1,780 ✭✭✭


    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, Registered Users 2 Posts: 243 ✭✭Blinder


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


  • Registered Users, Registered Users 2 Posts: 6,652 ✭✭✭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,780 ✭✭✭JackieChan


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

    JC


Advertisement