[A89] Re: TI-GCC enum question
[Prev][Next][Index][Thread]
[A89] Re: TI-GCC enum question
You may ignore this plea for help. TI-GCC seems to be more different than
standard C than I expected...
For those of you who'd like to know the answer:
#include <tigcclib.h> // Include All Header Files
short _ti89; // Produce .89Z File
// Main Function
void _main(void)
{
enum Bool ToF=0; //set ToF to be of type Bool (gray.h) and initialize to 0
int x=0; //set x to be of type int and initialize to 0
for(;x<9;ToF=x++) //why can't x be set and initialized in the for loop?
printf("%d ", ToF); //print results
}
You have to use 'enum' to define a variable with an enum type:
enum Bool ToF=0;
instead of standard C:
Bool ToF=0;
-Miles Raymond EML: m_rayman@bigfoot.com
AIM: Killer2Ray ICQ: 13217756 IRC: Killer2
WWW: http://www.bigfoot.com/~m_rayman
----- Original Message -----
From: "Miles Raymond" <m_rayman@bigfoot.com>
To: <assembly-89@lists.ticalc.org>
Sent: Wednesday, July 11, 2001 8:44 AM
Subject: [A89] TI-GCC enum question
> How exactly are you supposed to use an enum in TI-GCC?
>
> some sample code:
> #include <tigcclib.h> // Include All Header Files
>
> short _ti89; // Produce .89Z File
>
> // Main Function
> void _main(void)
> {
> Bool ToF=0; //set ToF to be of type Bool (gray.h) and initialize to 0
> int x=0; //set x to be of type int and initialize to 0
> for(;x<9;ToF=x++) //why can't x be set and initialized in the for loop?
> printf("%d ", ToF); //print results
> }
>
> Trying to compile that code results in the following errors:
> 'Bool' undeclared (first use in this function)
> Parse error before 'ToF'
> 'ToF' undeclared (first use in this function)
>
> Bool is supposed to be an enum declared in gray.h
> I have no idea what a parse error is
> ToF is supposed to be declared as type Bool
>
> -Miles Raymond EML: m_rayman@bigfoot.com
> AIM: Killer2Ray ICQ: 13217756 IRC: Killer2
> WWW: http://www.bigfoot.com/~m_rayman
References: