unknown type name 'interface'

Technical questions regarding the XTC tools and programming with XMOS.
DemoniacMilk
XCore Addict
Posts: 191
Joined: Tue Jul 05, 2016 2:19 pm

unknown type name 'interface'

Post by DemoniacMilk »

Not sure where this error comes from.
It does appear in some files that I have not changed in some time.
Cleaning the project did not help, neither did restarting xTimeComposer or the computer.
Did anyone run into this before?
peter
XCore Addict
Posts: 230
Joined: Wed Mar 10, 2010 12:46 pm

Post by peter »

Not something I've come across before. Can you give a code example? It sounds like there is something that has been changed in one of the headers you are including in other code that hasn't changed.

Have you included an XC header from C by any chance without having correct guards around the XC-specific code that the C compiler won't support?

Code: Select all

#ifdef __XC__

// XC-specific defines & types like interfaces.

#endif
Peter
DemoniacMilk
XCore Addict
Posts: 191
Joined: Tue Jul 05, 2016 2:19 pm

Post by DemoniacMilk »

Code: Select all

[..]
12 #ifndef SSCCONFIG_H_
13 #define SSCCONFIG_H_
14
15 typedef interface sscCfg_interface{
16     void foo();
17 }sscCfg_interface;
[..]
31 [[combinable]] void sscConfig(server sscCfg_interface cfg_if[n], unsigned n, chanend channelToManager);

#endif /* SSCCONFIG_H_ */
throws the errors
sscConfig.h:15:9: error: unknown type name 'interface'
sscConfig.h:15:35: error: expected ';' after top level declarator

sscConfig.h:31:2: error: expected expression
sscConfig.h:31:16: error: expected identifier or '('
In another file:

Code: Select all

typedef struct {
     unsigned int uiLength;
     short sDestination;
     short usRemainingClientCount;
     unsigned char ucaData[MAX_MESSAGE_LENGTH + 4];
}sscPacket_t;

typedef interface sscTx_interface {
    unsigned int sendData(unsigned char ucaSendMe[nbytes], unsigned nbytes, short sDestination);
}sscTx_interface;
again, complaint about 'interface' being unknown.
peter
XCore Addict
Posts: 230
Joined: Wed Mar 10, 2010 12:46 pm

Post by peter »

You don't show where that code is included from, and what the command is that is being used. It still looks like this could be from a header that is being included from a C file originally, where the tools won't support "interface".

Peter
DemoniacMilk
XCore Addict
Posts: 191
Joined: Tue Jul 05, 2016 2:19 pm

Post by DemoniacMilk »

Ou I understand now! I only included the header file in xC so far, but added an include in some part of the uIP stack that was written in C. I was not aware that including the header in a c-file will cause this behavior. Thanks for pointing that out.