Structures in CodeVision

Go To Last Post
2 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm trying to get a multiple file project going in CodeVision that uses a structure inside one of its functions. The primary file is the generic generated by the make app. The second file is another function that will go into a library at some point. This function (in the second file) uses a local internal structure. I get an "undefined tag 'MyStruct'" when I place the structure internal to the function. If I place the structure outside the function but in the same file I can compile without the error but my structure resides in global memory space - I prefer to hide it in the function. Does anyone have any suggestions or ideas.

Thanks,

Erick

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello,

You can place the structure definition outside the function and then use this
definition to declare the local structure:

// struct definition only
struct MyStruct {
int a;
char b[5];
};

void foo(void) {
// declare the local struct here
struct MyStruct abc;

}

Regards

Pavel Haiduc
HP InfoTech