[maemo-developers] [Make.am issue]Sofia throuwing Error message

From: Dave Neary dneary at maemo.org
Date: Mon Sep 8 11:13:50 EEST 2008
Hi Atul,

atul raut wrote:
> I am facing below Error seems like header order miss match.
> How to resolve it ?

You need to find out which header you're missing... there may be another
hint is a preceding warning.

This happens when you do something like this:

#include <stdio.h>
#include <stdlib.h>

struct test *t;

int main(void)
{
  t = malloc(sizeof *t);
  printf("%d\n", t->i);

  return 0;
}

You can declare structs without defining their structure, but you have
to define their structure before dereferencing them (and before
declaring them).

In the above example, adding
struct test {
  int i, j;
};

before the declaration of t fixes the problem (but creates a different
runtime problem - a virtual cookie for the person to see the issue).

This problem is most common in situations where people use typedef:

typedef struct {
  int i;
  float f;
} st;

struct st *a; /* this is wrong! we used typedef, so it should be just
"st a;" When we use *a or a-> we will get an error. */

> ../lahiri_sofsipcli/src/farsight-netsocket-stun.c: In function `cb_stun_state':
> ../lahiri_sofsipcli/src/farsight-netsocket-stun.c:317: error: dereferencing pointer to incomplete type
> ../lahiri_sofsipcli/src/farsight-netsocket-stun.c:318: error: dereferencing pointer to incomplete type

Check ../lahiri_sofsipcli/src/farsight-netsocket-stun.c, line 317, 318.

You will see a "a->b" or "(*a).b" type construct.

Look at the definition of a, it will be
"struct XXXXX *a"

Find out in which header "struct XXXXX" is defined, and include it.

Nothing to do with Make.am at all.

Hope this helps!

Cheers,
Dave.
-- 
maemo.org docsmaster
Email: dneary at maemo.org
Jabber: bolsh at jabber.org


More information about the maemo-developers mailing list