简体   繁体   中英

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

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 */
    ...
};
...

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.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM