struct reprVectorsTree;
#ifdef __cplusplus
extern "C" {
#endif
typedef reprVectorsTree * RHandle;
RHandle create_reprVectorsTree(float **, int , int );
void free_reprVectorsTree(RHandle);
float* work_decode(RHandle , bool*, int);
#ifdef __cplusplus
}
#endif
I wrote the interface header file according to the answer here How to use c++ objects in c? , but I get the syntax error? what is missing?
----edit---- I changed it to
struct reprVectorsTree;
#ifdef __cplusplus
extern "C" {
#endif
typedef struct reprVectorsTree * RHandle;
RHandle create_reprVectorsTree(float **, int , int );
void free_reprVectorsTree(RHandle);
float* work_decode(RHandle , bool *, int);
#ifdef __cplusplus
}
#endif
now I get the following error on the float* line
error C2143: syntax error : missing ')' before '*'
error C2081: 'bool' : name in formal parameter list illegal
error C2143: syntax error : missing '{' before '*'
error C2059: syntax error : ','
error C2059: syntax error : ')'
Try:
typedef struct reprVectorsTree * RHandle;
You can't just use a struct as if it's a type in C without a typedef (eg typedef struct reprVectorsTree;
)
EDIT: You'll also need to #include <stdbool.h>
for the bool
type assuming you're using a recent C compiler, or just use an int
instead.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.