0

I'm trying to declare a typedef union for a time format as follows, In the header I have :

typedef union _u_time
{
    unsigned long l_time;
    struct {
        unsigned char :8;
        unsigned char HRS;
        unsigned char MIN;
        unsigned char SEC;
    }BYTES;
}u_time;

And then I'm trying to use it this way :

void RTC_Set(long date, u_time time)
{
    RTC_SetTime(time);
    RTC_SetDate(date);
}

No problem to compile the project. I'm using E2Studio IDE from Renesas based on Eclipse and the problem is that u_time is not resolved in my *.c file and I can't use autocompletion which is a great advantage of Eclipse...

The only way I found to get all links resolved and autocompletion working is to add union in de function prototype like this :

void RTC_Set(long date, union u_time time)
{
    RTC_SetTime(time);
    RTC_SetDate(date);
}

Any idea ?

timrau
  • 22,578
  • 4
  • 51
  • 64
Toon
  • 3
  • 5
  • Are you showing the correct code? In the code shown, `u_time` and `union _u_time` are valid and identical, while `union u_time` doesn't exist. – ugoren Oct 08 '13 at 14:43
  • Am I the only one who doesn't know what you're actually asking? – zubergu Oct 08 '13 at 14:55
  • @zubergu, I thought I do, but I was wrong. After careful reading, it seems that his problem is with Eclipse autocompletion only. – ugoren Oct 08 '13 at 14:57
  • In fact, iI would like to use my RTC_Set function as mentionned is the second code block "void RTC_Set(long date, u_time time)" because my union type is already declared in the header. I don't understand why I need to add it to get the union type resolved ... – Toon Oct 08 '13 at 15:04
  • For a clearer example, if in a C function I use a time variable declared like this "u_time time;" , u_time is not resloved and I can't use autocompletion but compilation is OK. If i declare like this "union u_time time;" all is ok... – Toon Oct 08 '13 at 15:09

1 Answers1

-1

I solved my problem ! I had to use an Eclipse functionality which I didn't know !

Left click on the Project in the project Explorer Index -> Rebuild

Now autocomplete is ok, and no error remain about this problem.

Toon
  • 3
  • 5