[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Re: "incomplete type" error
Robert Marlow writes:
> 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.
Correct. LDAP is an 'abstract type': You are not supposed to use
or manipulate the type itself, only pointers to it.
> size_t size = sizeof (LDAP);
This line is buggy. 'sizeof applied to an incomplete type'.
> LDAP scm2ldap (SCM *ld_smob) {
This too. It should return 'LDAP *'.
> 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
> void
Misleading error message. The compiler has already told you that
you can use type 'LDAP' this way. Now it tries as best it can
to go on compiling, and apparently it uses a 'void' return type
instead of the invalid type, so you got this complaint.
--
Hallvard