Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12600 Discussions

errors of using bool type in program

Altera_Forum
Honored Contributor II
2,568 Views

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.
0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
1,044 Views

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'.
0 Kudos
Altera_Forum
Honored Contributor II
1,044 Views

thank you very much!i fix it with your help!

0 Kudos
Reply