468,512 Members | 1,423 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,512 developers. It's quick & easy.

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.
Oct 11 '06 #1
2 4801
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
Oct 11 '06 #2
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;
Oct 11 '06 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

8 posts views Thread by J. Campbell | last post: by
3 posts views Thread by Mochuelo | last post: by
4 posts views Thread by Frederick Gotham | last post: by
3 posts views Thread by knguyen | last post: by
11 posts views Thread by =?Utf-8?B?UGF1bA==?= | last post: by
5 posts views Thread by k.sahici | last post: by
15 posts views Thread by ssylee | last post: by
2 posts views Thread by Marcel Kloubert | last post: by
reply views Thread by NPC403 | last post: by
1 post views Thread by fmendoza | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.