Dereferencing pointer to incomplete type error for struct member access in Python swig C wrapper

967 views Asked by At

What is the error while compiling swig Python wrapper under GCC 4.8.2?

wfdb_python_wrap.c:3967:11: error: dereferencing pointer to incomplete type
if (arg1->fname) free((char*)arg1->fname);
       ^
wfdb_python_wrap.c:3967:36: error: dereferencing pointer to incomplete type
if (arg1->fname) free((char*)arg1->fname);

source code from wfdb_python_wrap.c:

...
#include <wfdb/wfdb.h>
...

#ifdef __cplusplus
extern "C" {
#endif
SWIGINTERN PyObject *_wrap_WFDB_Siginfo_fname_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
...                                 
struct WFDB_Siginfo *arg1 = (struct WFDB_Siginfo *) 0 ;
...
if (arg1->fname) free((char*)arg1->fname);
...

header file /usr/local/include/wfdb/wfdb.h:

...
struct WFDB_siginfo {   /* signal information structure */
    char *fname;    /* filename of signal file */
    ...
};
...
1

There are 1 answers

8
alex On BEST ANSWER

You declare this type:

struct WFDB_siginfo 

and use this one:

struct WFDB_Siginfo

which is different (note the uppercase S), so gcc truly believes struct WFDB_Siginfo is another type which has not been declared yet.