I'm trying to create a struct used in two .c source files to make a simple linked list structure. I thought it would save time to create a struct in the header file, however, I get a 'parse error before *' error.

2 Answers
2

Looking around in some of the XMOS documentation, it seems the problem is that XC is not C, it's just a C-like language. From the "XC Programming Guide":

XC provides many of the same capabilities as C, the main omission being support
for pointers.

...which explains why it doesn't accept the next and prev pointers in your structure.

Apparently xcc lets you mix C and XC sources, though, so if you were to limit your use of the structure to C code it should work. From the "XCC Command-Line Manual", it appears that anything with a .xc extension (as in the command line you used above) is treated as XC, rather than C, source code by default. This can be overridden by placing the option -xc before the C sources on the command line and -x afterward (or just rename the files with a .c extension).

If you must use XC rather than C, you may need to find another way of doing things (arrays, maybe?).

Oh wow! This is an embarrassing omission on my part, thanks kindly Dmitri! I feel quite humiliated by the last hour or so...
–
Tim GreeneDec 18 '11 at 3:20

Also, for anyone else struggling with the same issue, it's simple to include normal C code in XC using a header file, so outsource your data structure requirements out of the .xc file if possible, certainly don't define any pointers in any header file used by an .xc module, or you'll look like a fool.
–
Tim GreeneDec 18 '11 at 5:05