[Date Prev][Date Next] [Chronological] [Thread] [Top]

"incomplete type" error

Hi all

I'll admit up front that I'm not exactly a master C hacker but I've
gotten myself stumped on trying to get some code to compile using the
LDAP libraries. Unfortunately the lack of a full definition for the LDAP
type in ldap.h seems to be the cause of the problem but, because I'm
little more than a novice I can't be sure.

Here's some example code:

static size_t free_ldap (SCM ld_smob) {
  LDAP *ld = (LDAP *) SCM_SMOB_DATA (ld_smob);
  size_t size = sizeof (LDAP);


  return size;

And the associated error during compilation:

ldap-scm.c: In function `free_ldap':
ldap-scm.c:11: sizeof applied to an incomplete type

And another:

LDAP scm2ldap (SCM *ld_smob) {
  return (LDAP *) SCM_SMOB_DATA (ld_smob);

With error:

ldap-scm.c: In function `scm2ldap':
ldap-scm.c:51: warning: `return' with a value, in function returning

The only thing I can think of that could be causing this kind of error
is the fact that the most information the compiler can get about the
LDAP type prior to linking is:
typedef struct ldap LDAP;

But crazily I've compiled code using ldap.h which hasn't complained of
this at all (though I did nothing like sizeofs or returns of any LDAP

I've searched the mail archives and the OpenLDAP web site but haven't
found anything really useful. Can anybody please shed some light on this
for me?



Robert Marlow