Welcome, Guest. Please login or register.

Author Topic: VBCC: size of incomplete type not available / linker  (Read 964 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline JoseTopic starter

  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 2869
    • Show only replies by Jose
VBCC: size of incomplete type not available / linker
« on: April 14, 2005, 07:44:55 PM »
Hi. I'm getting "size of imcomplete type not avaible" with VBCC. WTF is that anyway?! I tryed to isolate the piece of code with that and it doesn't complain anaymore (bellow), go figure.
Also is there a big change in the latest VBCC so that you have to specify linking with amiga.lib ? If not then why does the bellow code get's an error with AllocMem in the linker? I tried it with -lamiga option but my A1200 crashed. I remember I had this problem in the past and forgot how I got over it, never bothered with that stuff, just rushed out coding:-D I'll try it again when I get home again...

Code: [Select]
#include <exec/memory.h>
#include <exec/types.h>
#include <stdio.h>
#include <stdlib.h>

#include <clib/exec_protos.h>

struct LONGSegment2Compare
{ LONG Offset;
  LONG *LONGsToCompare; /* Pointer to NULL terminated array of LONGs */
};

struct ConditionsToCheck
{ struct Node ConditionsToCheckNode;
  struct Conditions /* IMPORTANT: Bellow pointers to LONGSegment2Compare are pointers to a NULL terminated array */
  {  struct LONGSegment2Compare *AnyOfTheseFlagsMakesTrueIfTrue;
     struct LONGSegment2Compare *AnyOfTheseFlagsMakesTrueIfFalse;
     struct LONGSegment2Compare *TrueCombination;      struct LONGSegment2Compare *FalseCombination;
     struct Conditions *MutualExcl;
     struct MinConditions
     { struct LONGSegment2Compare *TrueCombination;
       struct LONGSegment2Compare *FalseCombination;
       struct Conditions *MutualExcl;
       struct MinConditions *Next;
     } *Next;
     struct Conditions *Terminal; /*Terminal points to the one that makes this forward linked list (through *Next) false */
  } Conditions;
  struct ActionSet **ActionSetPtrArray; /* Pointer to NULL terminated array of pointers to ActionSets to execute if this ConditionsToCheckList element is true*/
};

int main (int argc, char **argv)
{
 struct ConditionsToCheck Test;
 struct ConditionsToCheck *ConditionsToCheck = &Test;
 if (!(ConditionsToCheck->Conditions.TrueCombination = (struct LONGSegment2Compare *) AllocMem ((sizeof(struct LONGSegment2Compare)) * 2, MEMF_ANY)))
   printf (&quot;Something's wrong dude!!!&quot;);
 else
   printf (&quot;Way to go dude!!!&quot;);
 exit(0);
}
\\"We made Amiga, they {bleep}ed it up\\"
 

Offline Thomas

Re: VBCC: size of incomplete type not available / linker
« Reply #1 on: April 14, 2005, 09:09:47 PM »

You should increase the stack size to avoid crashes. If you don't want to use amiga.lib you have to include proto/exec.h instead of clib/exec_protos.h.

I don't get any incomplete type message from you code.

An incomplete type is a struct which has not yet been defined.

e.g.

#include stdlib.h>

void main (void)
{
struct xy *ptr;
ptr = malloc(sizof(struct xy));
}

Here "struct xy" is incomplete when used with sizeof() because the compiler does not know its size.

In your code you probably used the wrong case. E.g. struct LONGSegment2compare instead of struct LONGSegment2Compare.

Bye,
Thomas

Offline JoseTopic starter

  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 2869
    • Show only replies by Jose
Re: VBCC: size of incomplete type not available / linker
« Reply #2 on: April 15, 2005, 01:51:22 PM »
@Thomas
Hey 8-)

"You should increase the stack size to avoid crashes"
Done that, I discovered that my code got too big for a plain vanilla A1200, that´s the problem. It's more than 50K of source now.

"I don't get any incomplete type message from you code."

Yes, neither do I, I must have corrected the bug while trying to reproduce it, but I still can't find what's wrong in the original code :lol:

"In your code you probably used the wrong case. E.g. struct LONGSegment2compare instead of struct LONGSegment2Compare"

I tried to fix it again last night without any luck, I must be blind. I think I'm gonna wait till my A4000 is up and running again... Or maybe I'm gonna give WinUAE a try (not the ideal dev environment I know...)
The thing I don't understand is that my struct declaration posted here is copy/pasted from the original code, as well as the AllocMem line and I've checked everything and all names match. This is a weird one.
\\"We made Amiga, they {bleep}ed it up\\"
 

Offline Thomas

Re: VBCC: size of incomplete type not available / linker
« Reply #3 on: April 15, 2005, 03:49:55 PM »
Quote

It's more than 50K of source now.


Erm, and you compile it all in one go ? Must take ages.

You should create several small object modules which are linked together in the end.

The advantage is that you don't need so much memory and that only the changed modules have to be recompiled.

"Make" is your friend, really.

Bye,
Thomas

Offline JoseTopic starter

  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 2869
    • Show only replies by Jose
Re: VBCC: size of incomplete type not available / linker
« Reply #4 on: April 15, 2005, 04:50:12 PM »
I'm too lazy to define external variables and put the includes in there again for every function, but it's got big so I must do it one of these days.

BTW isn't "make" a GCC thing only? I've only tried VBCC and SASC for now, but I guess every compiler can compile separate modules, problem is each one has different interface. In VBCC that seems to be easy though ( if using vc)
\\"We made Amiga, they {bleep}ed it up\\"
 

Offline Thomas

Re: VBCC: size of incomplete type not available / linker
« Reply #5 on: April 15, 2005, 05:56:42 PM »

Make is one of the GNU binutils, but it can be used for any shell program, not only compilers.

Most Make ports for AmigaOS run standalone, without any reference to GCC or ixemul.

Bye,
Thomas