I'd like to know how to use this function in my program. I've included string.h but I still get this warning when compiling.
I'd appreciate some help with this. Thanks.warning: incompatible implicit declaration of built-in function ‘strndup'
I'd like to know how to use this function in my program. I've included string.h but I still get this warning when compiling.
I'd appreciate some help with this. Thanks.warning: incompatible implicit declaration of built-in function ‘strndup'
Implicit declaration means that it couldn't find it in the header file. Since your compiler thinks it's built-in that's a good start (i.e., you are on a system that has it in the first place). We've had something similar here before; if you read the man page on strndup it says that you need to have
before you include string.h if you want to get the extra fancy functions included.Code:#define _GNU_SOURCE
Ah, thank you. I actually tried defining __USE_GNU because that's what's in my /usr/inlude/string.h