Topic : "bool" error messages - doesn't make any sense

Forum : Ride IDE

Original Post
Post Information Post
December 23, 2008 - 7:31am
Guest

I am working with the STM32 and the ARM-Kit. One of the header files, from the ST Library, is called "stm32f10x_type.h", and on line 55, there is a "typedef enum" for "bool". So far, so good.

Everything was compiling fine, until I added a new file, then I got an error about 'bool' being re-defined. Since nothing made sense any more, I reduced the new file to a single line #include "stm32f10x_lib.h", a line which exists in all other files which compile correctly.

When I compile my project with the new file (with the single #include), I get an error message, as follows:

" C:\..my_path...\Library/inc/stm32f10x_type.h:55: error: redeclaration of C++ built-in type 'bool' "

If I save the file as a new file name, like "test_bool.c" it compiles okay, but if I save it as the original file name "io_init.c" the error message comes back.

This is so stupid that I am totally lost as to what is going wrong.

Can anybody please make some suggestions.

Thanks,
Garry.

Replies
Post Information Post
+1
0
-1
December 23, 2008 - 7:40am
Guest

Further information: I think the error may be related to the file name. If I re-name the file with lower case, like "Io_init.c" it compiles okay, but with the ALL_CAPITALS.C filename, it does not compile. Does this make any sense to anybody?

+1
0
-1
December 23, 2008 - 10:01am
Raisonance Support Team

Hi,

It is a GCC convention that *.C files, with a capital C, are to be compiled as C++ files, while *.c files, with a lower case c, are C files. At first it can be surprising for people coming from the Windows world where case is just for show, but once you know it, there is no problem.

Just for information, there is also a difference between *.s "normal assembler files" and *.S "assembler files to be preprocessed".

Best Regards,

Vincent