Compiler error

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Compiler error

1,043 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lmoreira on Tue Mar 29 23:48:13 MST 2011
Hi Guys,
I am writing a program in C for the LPC1343 board , where I am using an union of two structures and an array.
The problem is that I am getting an error when building the program, but I can not get what it is trying to tell me.

this is the header file where I get the error:

[PHP]/*
* dataBufferHandler.h
*
*  Created on: 8 Mar 2011
*  Author: LM
*    Version: 1.0
*  Description:
*
*/

#ifndef DATABUFFERHANDLER_H_
#define DATABUFFERHANDLER_H_

#define NUMBEROFBUFFERS            20

#define NUMBEROFRXDATAB         (NUMBEROFBUFFERS/4)

#define NUMBEROFTXDATAB         (NUMBEROFBUFFERS/4)

#define NUMBEROFRXPACKETB        (NUMBEROFBUFFERS/4)

#define NUMBEROFTXPACKETB        (NUMBEROFBUFFERS/4)

#define TXDATATYPE                1
#define RXDATATYPE                2
#define TXPACKETTYPE            3
#define RXPACKETTYPE            4

typedef union
{
    struct
    {

        char processNumber;
        char pNumberB;
        char dataSize;
        char data[50];

    }dataS;

    struct
    {
        char pStartChar;
        char pTypeChar[2];
        char pNumberH[2];
        char pSize[2];
        char pChecksum[2];
        char pData[100];
        char pEndChar;
    }packetS;
    char buffer[110];
}MultiBuffer;


MultiBuffer *getMultiBuffer();
uint32_t GetBufferOnQueue(uint32_t type, MultiBuffer pBuffer);

uint32_t setdataReady(TXData *pBuffer);


#endif /* DATABUFFERHANDLER_H_ */ [/PHP]
This is the error I get:
"expected '=', ',', ';', 'asm' or '__attribute__' before 'GetBufferOnQueue'"

I get this error on the prototype for the GetBufferOnQueue function.

I have tried this code on Pelles C and it works fine.

I don't think the problem is with this function but I can not see what the compiler is complaining about. Is there a problem with pointers or unions in LPCExpresso that I don't know about?

Been trying to sort this out for a few days and any help would be appreciated.
Thanks
Best Regards
                   Luis
0 Kudos
Reply
3 Replies

1,032 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by atomicdog on Wed Mar 30 18:28:15 MST 2011
uint32_t is defined in <stdint.h>.
0 Kudos
Reply

1,032 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lmoreira on Wed Mar 30 02:13:15 MST 2011
Hi Zero,
you are completely correct :), thank you very,very much. the problem was exactly as you described, I change it to unsigned int and it compiles.
I now also found out why it did work on other files, and not on this one. On the other  files I have included "LPC13xx.h" which has the definitions or is including the definitions for uint32_t, but failed to do that on "dataBufferHandler.c".

thank you very much.
Best Regards
                     Luis
[COLOR=Black][COLOR=#000000][COLOR=#FF8000][/COLOR][/COLOR][/COLOR]
0 Kudos
Reply

1,032 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Wed Mar 30 00:10:14 MST 2011
Compiler is complaining about something before 'GetBufferOnQueue' :mad:

That's 'uint32_t' :). Obviously that's an unknown typedef.

So either use a known type as 'unsigned int' or include a typedef header like 'type.h'.
0 Kudos
Reply