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(-D) on const type * versus type *

I have a sourcecode like:

typedef int tQ32_16;
typedef tQ32_16 tVector3[3];

tQ32_16 Length_V3(const tVector3 * vec) {....;}

void anyfunc(void)
{

tVector3 v1 = {1,2,3}; tQ32_16 l1;

l1 = Length_V3(&v1); //==>> warning: #167-D: argument of type "tVector3 *" is incompatible with parameter of type "const tVector3 *"

....
}

Why do I get this warning ??
As far as I know this is correct C-code....

Parents
  • I just created a NEW uVision project (MDK-ARM Professional v4.50)

    TARGET: NXP LPC1313, everyting else just default.

    and added just the following code (main.c):

    
    typedef int tQ32_16;
    typedef tQ32_16 tVector3[3];
    
    tQ32_16 Length_V3(const tVector3 * vec)
    {
        tQ32_16 result = (*vec)[0];
    
        return result;
    }
    
    int main(void)
    {
        tVector3 v1 = {1,2,3};
        tQ32_16  l1;
    
        l1 = Length_V3(&v1);
    
        return l1;
    }
    
    

    And when I compile I get the following output:

    Build target 'Target 1'
    compiling main.c...
    main.c(17): warning:  #167-D: argument of type "tVector3 *" is incompatible with parameter of type "const tVector3 *"
    main.c: warning: #167-D: argument of type "tVector3 *" is incompatible with parameter of type "const tVector3 *"
    linking...
    warn167_test.axf: Error: L6218E: Undefined symbol SystemInit (referred from startup_lpc13xx.o).
    Target not created
    

Reply
  • I just created a NEW uVision project (MDK-ARM Professional v4.50)

    TARGET: NXP LPC1313, everyting else just default.

    and added just the following code (main.c):

    
    typedef int tQ32_16;
    typedef tQ32_16 tVector3[3];
    
    tQ32_16 Length_V3(const tVector3 * vec)
    {
        tQ32_16 result = (*vec)[0];
    
        return result;
    }
    
    int main(void)
    {
        tVector3 v1 = {1,2,3};
        tQ32_16  l1;
    
        l1 = Length_V3(&v1);
    
        return l1;
    }
    
    

    And when I compile I get the following output:

    Build target 'Target 1'
    compiling main.c...
    main.c(17): warning:  #167-D: argument of type "tVector3 *" is incompatible with parameter of type "const tVector3 *"
    main.c: warning: #167-D: argument of type "tVector3 *" is incompatible with parameter of type "const tVector3 *"
    linking...
    warn167_test.axf: Error: L6218E: Undefined symbol SystemInit (referred from startup_lpc13xx.o).
    Target not created
    

Children
No data