I am trying to include a “c” header file in a cpp file.
The c header file has the keyword “Boolean”.
c header looks something like this:
#ifndef _CONFIGSTORE_H_
#define _CONFIGSTORE_H_
#ifdef __cplusplus
extern "C"
{
#endif
Boolean ConfigStoreIsPassword(char *pName);
#ifdef __cplusplus
}
#endif
#endif //_CONFIGSTORE_H_
Below is the way i am including the c header in my cpp file:
extern "C"{
#include "configstore.h"
}
or
#ifdef __cplusplus
extern "C"
{
#endif
#include "configstore.h"
#ifdef __cplusplus
}
#endif
Either way i include, i get the below error:
../../../../src/Common/framework/configstore.h:52: error: ‘Boolean’ does not name a type
Could you please let me know how i can add the c header in cpp file
Thanks in advance!!
-Vasavi
Two things spring to mind here. One, you are nesting an
extern "C"block inside anotherextern "C"block. Remove the outer blocks.Two,
Booleanis not a keyword in c++.boolis. Try addingtypedef bool Boolean;before your header inclusion.