user6161
user6161

Reputation: 289

C error: expected '=', ',', ';',

Im working on a PIC24f microcontroller, writing a C code for communication protocol.Im facing an error in function Reade2PW. I thought uint16_t gives the problem so i changed the "uint16_t" to "int16" & "int16_t" and compiled but the problem is still remains the same i.e it gives the same error. My MPLAB using XC16 compiler. I read XC16 user guide, it can support uint16_t and int16_t. Here is the screenclip from the XC16 user guide.

enter image description here

How to solve this problem? Your valuable suggestions will be highly appreciated.

Thanks

#include<stdio.h>
#include <stdint.h>

int main(void)
    {
        ..
        ..
        return 0;
    }

unsigned uint16_t Reade2PW(unsigned uint16_t rde2pw) //Error here
        {   
            unsigned uint16_t EEPVal;
            unsigned char i, *Ptr;
            ....
        }
void SaveE2PW(unsigned uint16_t rde2pw, unsigned uint16_t Cx)//Error here
       {    
            unsigned char i, *Ptr;
            ..
       }

Error Description:

error: expected '=', ',', ';', 'asm' or '__attribute__' before 'Reade2PW'
error: expected ';', ',' or ')' before 'rde2pw'

Upvotes: 0

Views: 89

Answers (1)

Jack
Jack

Reputation: 16724

You have duplicate type specifiers in both your functions:

unsigned uint16_t Reade2PW(unsigned uint16_t rde2pw) //Error here
^^duplicate types here      ^^ and here

Remove one. The uint16_t is already unsigned (so the u prefix). So just remove the unsigned from them:

uint16_t Reade2PW(uint16_t rde2pw)
        {   
            uint16_t EEPVal;
          // ....
        }

Upvotes: 3

Related Questions