Error when using "bool" type

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • abelniel
    New Member
    • Oct 2006
    • 1

    Error when using "bool" type

    Hi all,
    When I use "bool" type in my program, gcc pop an error

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

    I have included the following lib:

    #include <stdio.h>
    #include <stdlib.h>
    #include <errno.h>
    #include <string.h>

    So why do I get that error?
    Thanks you all.
  • dariophoenix
    New Member
    • Oct 2006
    • 34

    #2
    If you're working in C, the problem is that bool is not a built-in type, as it is in C++. If you're working in C++... no idea

    Comment

    • dynamicleo
      New Member
      • Oct 2006
      • 14

      #3
      bool is not premitive type in C and some C++ version

      if you want to use bool data type, you define as following:

      typedef enum bool { false, true };

      and then you can use as following:

      bool isEqual(bool, bool);

      bool logicValue = true;

      Comment

      Working...