Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error :Unknown type name BOOL for c function in Xcode

I am building a static library which has some c functions (both .h and .m file) with return type bool, after adding it to my existing project I am getting Unknown Type name 'BOOL'. I tried importing stdbool.h but still I am getting same error.So can someone tell me right way to add c functions in Xcode project.The method definition looks like

BOOL isDeviceWorkingFine();
like image 519
Vaibhav Avatar asked Oct 23 '25 09:10

Vaibhav


1 Answers

In stdbool.h, the definition is provided as bool which is a MACRO which gets expanded to _Bool. The BOOL you're using is not standard C.

If you want to use the standard definition provided by stdbool.h, you may want to change the BOOL to bool.

Otherwise, you need to use some other specific header file, which actually provides the definition of BOOL for your implementation.NOTE


NOTE: as mentioned in the comments by Mr Blagovest Buyukliev, you may need <Foundation/Foundation.h>.

like image 154
Sourav Ghosh Avatar answered Oct 25 '25 22:10

Sourav Ghosh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!