parse error before ...

As a beginning programmer in C (for Palm OS) i stumbled on a parse error i can't get rid of. Hope someone can help me with some (obvious) beginner mistakes i might look at.

These are the portions of code i think are relevant:

File: MyTimer.h #define myTimerDbDataType 'DATA'

File: MyTimerDB.c
1
2
(includes MyTimer.h)
Err MyTimerGetDatabase (UInt32 type, DmOpenRef *dbPP, UInt16 mode)


File: MyTimer.c
1
2
3
4
5
6
7
8
9
10
11
(includes MyTimer.h)

static UInt16 AppStart (void)
{ Err error = 0; 
  UInt16 mode;
  UInt32 value;
  DateTimeType dateTime; 
  LocalID dbID;

  error = SysCurAppDatabase (&MyTimerCardNo, &dbID);
  error = MyTimerGetDatabase(MyTimerDbDataType, &MyTimerDbData, dmModeReadWrite);


Last line gives error: parse error before 'MyTimerDbDataType'

Casting MyTimerDbDataType to UInt32 resulted in the same error.

P.S.
The program is for the Palm OS, which may explain odd type names.
Last edited on
Well, you define myTimerDbDataType as 'DATA', which is incorrect. If you want a string, you need to use "" instead of '' (they show that it is a character, not a string). If you wanted a character (I think you do, since you are casting it to a Uint (can't do that with strings)), you will need to only pass one character.
No, i want to use type as a 4-byte value (not a null terminated string) that generally contains readable characters. It's done exactly this way in other examples i have.

Using double quotes gives the same error.

As the errror occurrs before the type parameter, my guess is that something is wrong with (resolving) the function name.
As the call and the function are not in the same source file, do i need to prototype the functions somehow or maybe tell the compiler to also look in other source files?
Last edited on
Ah...yeah. Put in some header protection too, and prototype the functions in the .h file.
Thanks.

This suddenly gave me a ton of other errors (gives me something to do).
It looks like 'MyTimerDB.c' wasn't processed at all. I'm not sure what changed this, but at least i can continue now.
Topic archived. No new replies allowed.