Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12606 Discussions

C-Typedef struct with µClinux

Altera_Forum
Honored Contributor II
989 Views

Hi all, 

 

I'm trying to use in my header file the simple following code : 

 

typedef enum 

COUNTER1 = 0, 

COUNTER2 = 1, 

} ERRORCOUNTER; 

 

and in my .c main file something like : 

 

U32 GetErrorCount(errorcounter Counter,FE_STV0900_DEMOD_t Demod) 

... 

/*Read the Error value*/ 

switch(Counter) 

case COUNTER1: 

... 

 

but when I compile, I always get the same compilation error : 

 

"error: `ERRORCOUNTER' undeclared (first use in this function)" 

 

 

whereas I checked the# include header declarations twice !! 

 

So here is my question : can we use typedef enum and typedef struct in µClinux ?? 

 

Thanks for your help ! 

 

0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
276 Views

 

The simple answer is of course you can typedef structs and enums. Your example is not complete enough to see what's wrong. The obvious question is: did you include the header?  

good luck, Alex
0 Kudos
Altera_Forum
Honored Contributor II
276 Views

<div class='quotetop'>QUOTE (papyenfurie @ Jul 16 2009, 01:55 PM) <{post_snapback}> (index.php?act=findpost&pid=23153)</div> 

--- Quote Start ---  

So here is my question : can we use typedef enum and typedef struct in µClinux ??[/b] 

--- Quote End ---  

 

 

For that matter, the question should be whether our compiler (nios2-linux-uclibc-gcc) supports that kind of strucutre. I&#39;m pretty sure it does, I use it all the time. 

 

Could you please post the smallest, simplest source code that reproduces the same error you are seeing? It would make things easier for people wanting to help. 

 

Cheers, 

 

Ricardo.
0 Kudos
Reply