NOTICE: The Processors Wiki will End-of-Life in December of 2020. It is recommended to download any files or other content you may need that are hosted on processors.wiki.ti.com. The site is now set to read only.

Invalid combination of type specifiers and Bool

From Texas Instruments Wiki
Jump to: navigation, search

In the newer versions of the compiler, an error may be emitted regarding the definition of the following:

  • The _Bool type
  • The bool typedef or macro
  • The true and false macros
  • The __bool_true_false_are_defined macro

To fix this issue, remove the macro definitions and typedefs listed above and replace the code with:

#include <stdbool.h>

Prior to support for the standard header <stdbool.h>, users often manually defined the above identifiers. When not guarded properly, this added code will cause errors at compile-time in the default (relaxed) language mode. The error will take a form such as:

"bool_fail.c", line 1: error: invalid combination of type specifiers

This is because _Bool is defined internally, and the compiler is reading a single type called 'unsigned int _Bool' rather than a typedef of '_Bool' to the type 'unsigned int'