This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Warning 167

Howcome is it that the following code:

#include <string.h>

static unsigned char buf[ 20];

void func( void)
{
   strcpy( buf, "huuhaa");
}
gives warning:
huuhaa.c(7): warning:  #167-D: argument of type "unsigned char *" is incompatible with parameter of type "char *"
even though strcpy prototype in string.h is:
extern unsigned char *strcpy   (unsigned char *s1, const unsigned char *s2);
??

Parents
  • The header file you are looking at is the CARM header file. But you are using the RealView Compiler which uses the header file in the folder ARM\RV30\INC\STRING.H. This header file defines the string functions with plain char datatypes and therefore a cast operation is required to avoid warnings.

    void func( void) {
       strcpy( (char *) buf, "huuhaa");
    }

Reply
  • The header file you are looking at is the CARM header file. But you are using the RealView Compiler which uses the header file in the folder ARM\RV30\INC\STRING.H. This header file defines the string functions with plain char datatypes and therefore a cast operation is required to avoid warnings.

    void func( void) {
       strcpy( (char *) buf, "huuhaa");
    }

Children