Page 1 of 1

PostPosted: Thu Dec 14, 2006 4:53 pm
by tonyhunterajh

I am trying to create a pointer to a data structure that I can reuse within an object. I am getting this error when I compile...

"type name expected"

This is the code...

// Event Data Record Structure.
struct EventRecord {
string Event;
Date EventDate;
string EventType;
string EventNotes;
int EventCookingStatus;
int EventFinishedStatus;

EventRecord CurrentEvent;
EventRecord* pEventRecord;
pEventRecord = &CurrentEvent;

The error occurs on the last line. What am I doing wrong?



PostPosted: Sat Dec 16, 2006 10:32 pm
by tonyhunterajh
Can anyone help me with this?

I have searched the forum and found a post where someone was having the same issue but it is not clear whether this can be done or not. The documentation seems to indicate that it can; however, I continue to get this message. Please help!


PostPosted: Sat Dec 16, 2006 11:06 pm
by FrankG

I pasted your code into a test project I use and it worked okay. I had to put the struct def at the very top of the main project oc file but otherwise didn't change anything. It compiled okay for me with OrbForms Designer.


PostPosted: Sat Dec 16, 2006 11:36 pm
by tonyhunterajh
Frank, thanks. I will move some things around and see what happens.


PostPosted: Sun Dec 17, 2006 2:27 am
by tonyhunterajh
Well, no go. :( No matter where I place this code it will not compile under PocketC Architect v4.1.1 Build 79 (24 Aug 2006).


PostPosted: Mon Dec 18, 2006 1:10 am
by dewey
The problem is likely that you are trying to execute the assignment in the global scope. You need to move the assignment statement into a function or method.

PostPosted: Tue Dec 19, 2006 4:28 pm
by FrankG
Makes sense. I had copied the code into app.onstart() as a logical place to put it and then had to move the struct definition into the main oc (in global.) So I did what you recommended in the opposite order and it compiled.