Unable to define new struct

Posted By: Ekar

Unable to define new struct - 06/18/07 01:16

The following code does not compile in lite-C for me:
typedef struct SPACESHIP{
var x;
} SPACESHIP;

keyword unknown SPACESHIP
Parameter unknown typedef bad keyword in {}
are the errors (along with parm unknown error for the var)
lite-C ver 7.02.4 clean install.

From examples and tutorials I have read, this should work. Any ideas?

Thanks in advance.
Posted By: Excessus

Re: Unable to define new struct - 06/18/07 10:07

The typedef must be in the global scope I think.
Posted By: Ekar

Re: Unable to define new struct - 06/18/07 12:13

It is globally defined. That would be a good first assumption though.

I also note 3 more errors with lite-C

1. #define substitution is not working
2. Switch...Case statements fail to compile
3. ++ syntax is not known either

According to the supplied manual, these are all valid in lite-C. Could it be an issue with having the free version I'm testing? I didn't see these limitations documented anywhere. Then again, I'm probably just missing something silly. That happens a lot as well.
Posted By: Excessus

Re: Unable to define new struct - 06/18/07 13:21

That's very strange. There are no syntactical limitations in the free version of Lite-C. Here are some possible causes/solutions:

-Instal the latest release of Lite-C (1.03)
-Check your code right before lines that produce errors. There might be something wrong that is the true cause of these errors.
-If you have multiple instalations of gamestudio and/or lite-c, make sure you are running the right SED, or you might invoke the wrong engine. I've had such problems before. Make sure you open the SED from C:\program files\litec, not GStudio6.

The 3 things you mentioned all work fine here. Try running them in a very small test project. If that doesn't work, reinstal Lite-C.
Posted By: JibbSmart

Re: Unable to define new struct - 06/18/07 22:45

make sure the file you're compiling is a .c, not a .wdl.

aside from that, i'm at a loss as to what can be causing your problem.

julz
Posted By: ultranet

Re: Unable to define new struct - 06/20/07 06:54

typedef struct SPACESHIP{
var x;
} SPACESHIP;

It is totally correct. And I have test it and run normally.
Posted By: Ekar

Re: Unable to define new struct - 06/21/07 18:08

JulzMighty had the problem pinned down. I was compiling a .wdl file.

I knew it was something silly. Those are normally the hardest problems to explain.

I appreciate everyone's help on this.
Posted By: TWO

Re: Unable to define new struct - 06/21/07 18:11

Note that you can leave out the first name:

typedef struct {
var x;
} SPACESHIP;
© 2024 lite-C Forums