cancel
Showing results for 
Search instead for 
Did you mean: 

I migrated a successfully generated iar program manually in to stm32cube IDE. Even though the declaration is correct it keep saying conflicting type. Why is it so?

Nmv1608
Associate II
 
5 REPLIES 5

Error says what specifically? And what do those lines have on them? Most of this stuff can be troubleshooted if you provide sufficient/adequate information.

Some of the newer compilers have a lot more rigour in what they complain about, and aren't going to tolerate a redefinition of types.

Check the version of C/C++ the GNU compiler is implementing/enforcing, check if that is consistent with IAR

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Andrew Neil
Evangelist II

Usually, GCC does not just say "conflicting type" and leave it at that - it will usually go on to detail what type it was expecting, and what it saw instead.

As @Community member​  says, you haven't given enough detail to make any more specific suggestions.

You need to post the code that gives the error, and the complete, unabridged message - use copy & paste; do not manually re-type.

Use the 'Code Snippet' button.

S.Ma
Principal

I had a similar compiler issue because for gcc "int" is different type than "uint32_t" as return parameter of a function.

Maybe something like this ?

Nmv1608
Associate II
void parse_ipv6_address(uint8 *v, uint8 *buf)
{
  uint8 value = 0;
  uint8 offset = 0;
  uint8 index = 0;
  uint16 buffer_offset = 0;
  uint8 temp_buff[10];
  uint32 v6[4] = {'\0'};
  temp_buff[0] = '\0';
  uint8 i = 0;
  //! Total 8 octets
  for(index = 0; index < 8 ;index++)
  {
    //! each octet contains max of 5 characters including . dot
    for(offset = 0;offset < 5 ; offset++)
    {
      value = buf[buffer_offset++];
      if((value == '.') || (value == ':'))
      {
        break;
      }
      temp_buff[offset] =  value;    
    }
    temp_buff[offset]= '\0';
    if(index % 2 == 0)
    {
      v6[index/2] = (parseHex(temp_buff) << 16);
    }
    else
    {
      v6[index/2] |= parseHex(temp_buff);
    }
    temp_buff[0] = '\0';
  }
 
  for(i = 0; i < 4; i++)
  {
    rsi_uint32_to_4bytes((v+(4*i)), v6[i]); //  Function definition
 
  }
}

the problem started when I migrated the code to gcc compiler.

void rsi_uint32_to_4bytes(uint8 *dBuf, uint32 val);
void rsi_uint16_to_2bytes(uint8 *dBuf, uint16 val);// function declaration
void string2array(uint8 *dst, uint8 *src, uint32 length);
../Core/Src/wifidrv/rsi_app_util.c:626:5: error: too many arguments to function 'rsi_uint32_to_4bytes'

the error is showing there is conflicting types and when i made changes it keep saying the above error.

  for(i = 0; i < 4; i++)
  {
    rsi_uint32_to_4bytes((v+(4*i)), v6[i]); //  Function definition
 
  }

No, that is not the function definition!

That is a call to the function!

../Core/Src/wifidrv/rsi_app_util.c:626:5: error: too many arguments to function 'rsi_uint32_to_4bytes'

Note that this tells you exactly where the error is detected: it's at line 626 in the file rsi_app_util.c