Codewarrior for CF bool support

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Codewarrior for CF bool support

3,043 Views
Neilp
Contributor I
Hi all.

In Codewarrior for Coldfire V6.4 SE, I can't seem
to get the compiler to understand the bool data type.

I have the following declaration:


Code:
bool rc5_detect(void);

 

which produces the following error:

Error  : undefined identifier 'bool'
irlearn_routines.h line 2 bool rc5_detect(void);

I have 'Enable bool support' checked in the language settings,
and the keyword appears in blue in the editor, suggesting that
it is recognized as a keyword.

I don't know if any other header files need to be included, as
bool is a language keyword, is it not?

Does anyone know what I might be doing wrong?

Regards,
Neil.
Labels (1)
0 Kudos
2 Replies

860 Views
CompilerGuru
NXP Employee
NXP Employee
With C99,
you have to include
#include <stdbool.h>
for bool to be known.
In C89, there is no bool type, you can typedef your own, of course.
In C++, bool is builtin, but the C++ support needs the professional license.
I'm not sure what the "Enable bool Support" preference exactly does, but I fear it enables the C++ bool support which then does not get enabled because of the C++ licensing issue.

Daniel
0 Kudos

860 Views
Neilp
Contributor I
Thanks for the info Daniel.

If I #include <stdbool.h> I get:

Warning : preprocessor warning directive
stdbool.h line 20 #warning "MSL support for C99 is not enabled"

As a result, bool is still not understood.

Going into the language settings panel and checking "Enable C99
Extensions" once again does nothing to fix the warning.

What I did try was to goto  C:\Program Files\Freescale\
                            CodeWarrior for ColdFire V6.4\
                            E68K_Support\msl\MSL_C\MSL_E68k\
                            Include\

and edit ansi_prefix.CF.size.h and then change
#define _MSL_C99 from 0 to 1.

This fixes the problem, but my question is, is it safe to edit
this file. I don't want to mess anything up down the road.

Of course, like you say I could typedef my own, which I suppose
would look like:

Code:
typedef unsigned char bool;#define  FALSE  0#define  TRUE   1
 

Regards,
Neil.
0 Kudos