- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
when i tried to define a bool type data or use bool type as my function's parameter,there is many error messages displayed in the concole.
like this: ../hello_world.c:23: error: `bool' undeclared (first use in this function) ../hello_world.c:23: error: (Each undeclared identifier is reported only once ../hello_world.c:23: error: for each function it appears in.) ../hello_world.c:23: error: syntax error before "b" i figured that the compiler recognised bool as a valid data type since it is highlighted the same as other types. How to fix that? ps:i only include <stdio.h>in my program.Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You need to include stdbool.h as well.
The editor probably has a different list of known typenames. OTOH the compiler will generate better code if you avoid 'bool'.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
thank you very much!i fix it with your help!
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page