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

A warning suddenly becomes an error !?

Hi,

I'm working on a big project with a lott of sources files.
At compilation time I have a lot of #167-D warning
( warning: #167-D: argument of type "U8 *" is incompatible with parameter of type "const char *" for example ) .

Today I move some functions to another new source file to clean my code.
But when I compile , I get new errors in my new source file :
"error: #167: argument of type "U32 *" is incompatible with parameter of type "U8 *"

The warning in a source file becomes an error in another source file !!!

I didn't setup anything different for this source file , all compilation options are defined by the project.

What is the problem and how to solve it please ?

Parents Reply Children
  • Several things to think about here:

    "U8*" and "const char*" can differ in two ways. One is const. One is not. You can send a non-const parameter to a function that expects a const parameter. You can not send a const parameter to a function that does not specify that it takes a const parameter. And then char can be signed or unsigned depending on compiler and optional compiler switches.

    U8* and U32* is always incompatible. The "pointer" may be of the same size, but the data type the pointer points to is incompatible so a typecast is needed to convert from one pointer to the other. But to perform the type cast, YOU must know that it is correct to perform the cast.

  • You're right Per,

    So I ask my aquestion differently :)
    why the same function returns me #167-D warning when its source code is in one file ,
    and a #167 error code when the same source code is in another file ???

    The settings for all the files of the project are the same.

  • You have to figure out why the variable was of type U8 if the function - or if it was the function call - was located in one file, and of type U32 when you moved the code to another file.

    Somehow, you may have two header files that specifies different data types, or you have one header file specifying one data type, and a source file defining another data type.