본문 바로가기

Programming

Linux C - bool 자료형 사용 에러 (error: unknown type name 'bool')

간만에 리눅스에 C로 코딩중인데, bool 자료형을 사용 했더니 뜬금없이 아래와 같은 컴파일 에러가 발생했다.


test.c:184:2: error: unknown type name 'bool'

test.c:184:15: error: 'false' undeclared (first use in this function)

test.c:184:15: note: each undeclared identifier is reported only once for each function it appears in

test.c:209:13: error: 'true' undeclared (first use in this function)


찾아보니,

C90은 boolean 자료형을 지원하지 않고,

C99는 아래의 헤더를 사용해야 사용가능하다고 한다.

#include <stdbool.h>