471,047 Members | 1,303 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,047 software developers and data experts.

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 5208
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

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.