CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

errors with structure pointers

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Guest








errors with structure pointers
PostPosted: Wed Sep 22, 2004 8:23 pm     Reply with quote

I'm trying to compile the following code using compiler version 3.202. This is a fairly simple set of linked structures, but the compiler keeps choking on it.

Without the extern statements the compiler predictably claims the forward reference structure pointers point to undefined variables.

With the extern statements I get "Identifier already in use in this scope."
How am I suppose to make this type of linked structure setup work?

Also I should be able to have text defined as a char* instead of an array. The compiler should put the string in memory, then insert a pointer in the structure. This does not work either. I have to waste memory with an array instead.

Any assistance would be greatly appreaciated.

cheers,
darryl moore

Code:

#include <18F6720.h>

typedef struct menu_struct
{
    char text[15];   // one line of text to display for this menu
    char flags;   // characteristics of this menu
    int8 *value;  // what if any value this menu displays/edits
    struct menu_struct *up;   // next menu when we scroll up
    struct menu_struct *down; // next menu when we scroll down
    struct menu_struct *sub;  // sub menu to select if we press enter
}menu_t ;

extern menu_t master_menu;
extern menu_t service_menu;

menu_t user_menu =
{
    "USER MENU",
    0,
    0,
    0,
    &master_menu,
    0

};

menu_t master_menu =
{
   "MASTER MENU",
   0,
   0,
   &user_menu,
   &service_menu,
   0//master_main_menu,
};

menu_t service_menu =
{
   "SERVICE MENU",
   0,
   0,
   &master_menu,
   0,
   0//service_main_menu,
};

alexz



Joined: 17 Sep 2004
Posts: 133
Location: UK

View user's profile Send private message

PostPosted: Tue Oct 05, 2004 7:01 am     Reply with quote

Try instead of *pntr, use pntr->struct name
_________________
Alex
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group