unknown type name error in Vitis

Hi folks.

i works on Vitis environment which is based on eclipse.
I have very complex code, with .c file and headers.
sometimes it is compiling and sometimes it is giving this strange errors:
unknown type name <name of struct> , but when pointing by ctrl+click
to this struct it manage to find him in the same .h file.

for example:

this code is in the file st15.h:

1
2
3
4
 
///< A pointer to an interrupt service routine.
typedef S16BIT(_DECL *ISR_FUNCTION)(const InterruptInformationStructure* iisp);


this line gives error:
unknown type name 'InterruptInformationStructure'

When pointing to the definition of the struct it goes the
the same st15.h file.

Appreciate any help in sorting out those errors.
Are there any #ifdef lines in the file like this?

1
2
3
4
5
6
7
8
9
10
#ifdef SOMETHING
typedef struct {
  int foo;
} InterruptInformationStructure;
#endif

// more code

///< A pointer to an interrupt service routine.
typedef S16BIT(_DECL *ISR_FUNCTION)(const InterruptInformationStructure* iisp);


If your InterruptInformationStructure is conditionally compiled in (maybe there are several alternatives depending on the system you're building for), you need to set the appropriate compiler flag to select one.
When you say compiler flag you mean
SOMETHING symbol?
When pointing to the definition of the struct it goes the the same st15.h file.
Can you show the definition of the struct?
When you say compiler flag you mean
SOMETHING symbol?

Yes, you would use this
gcc -DSOMETHING prog.c

Are your struct's actually surrounded by conditional compilation?
Remember, we can't see your whole file, this is all guessing at the moment.

> sometimes it is compiling and sometimes it is giving this strange errors:
Is there any correlation between doing a full clean build and just recompiling the changes?



Is this the vitis you're talking about?
https://www.xilinx.com/products/design-tools/vitis/vitis-platform.html
> Ganado
send you in private massage

> Are your struct's actually surrounded by conditional compilation?
No. The code isn't confined in any #define.

but i noticed have the definition of struct in multiple .h files in the workspace

>Is there any correlation between doing a full clean build and just recompiling the changes?
i think it is the same

>Is this the vitis you're talking about?
yes
Last edited on
> but i noticed have the definition of struct in multiple .h files in the workspace
So there is some conditional logic somewhere then.

Otherwise, instead of "unknown type name 'InterruptInformationStructure'", you would be getting "redeclaration of type name 'InterruptInformationStructure'".

Some part of your build process is supposed to select exactly one declaration of your structure, but fails for some reason.
The code is working properly in other versions of the environment

i think it is compiler/ linker settings, or path and symbols
Hy friends,

I have noticed something interesting:

I have this function prototype:

1
2
3
4
_EXTERN S16BIT _DECL sitalBc_Message_GetByIdDecoded (	S16BIT swDevice,
														S16BIT swMessageId,
														sitalDecodedMessageStructure* dmspDecodedMessage,
														U16BIT wIsPurgeRequired);


that gives this error:

unknown type name 'sitalDecodedMessageStructure'; did you mean 'sitalDecodedMessageStruct'?

This is the definition of the struct:

1
2
3
4
5
6
7
8
typedef struct sitalDecodedMessageStructure
{
	/// Message type (sitalMessageType_*).
	/// Equivalent DDC definition: wType
	U16BIT wType;
      ......	

} sitalDecodedMessageStruct;


Should the struct really be called 'sitalDecodedMessageStruct' from c standpoint?
This is one of the of the areas where C and C++ differs.

In C you can either write struct sitalDecodedMessageStructure or just sitalDecodedMessageStruct (without the struct keyword).

I think you could use the same name for both if you wanted...

1
2
3
4
5
typedef struct sitalDecodedMessageStructure
{
      ...

} sitalDecodedMessageStructure;

Or just leave out the first one ...

1
2
3
4
5
typedef struct
{
      ...

} sitalDecodedMessageStructure;

I don't normally use C so I'm going mostly by what seems to work. There might be reasons for doing it one way or the other that I'm not aware of.

In C++ this is not necessary. You don't need to use typedef and you will still be able to write sitalDecodedMessageStructure without the struct keyword.

1
2
3
4
5
struct sitalDecodedMessageStructure
{
      ...

};
Last edited on
> Should the struct really be called 'sitalDecodedMessageStruct' from c standpoint?
It doesn't make a difference to C what you call it, so long as it's a unique name.
It depends what the local coding conventions are for the system you're working on.

Leaving the struct name blank is allowed, so you only have the typedef name.
1
2
3
4
5
6
typedef struct
{
	/// Message type (sitalMessageType_*).
	/// Equivalent DDC definition: wType
	U16BIT wType;
} sitalDecodedMessageStruct;


Making the struct name and typedef name the same is also allowed.
1
2
3
4
5
6
typedef struct sitalDecodedMessageStruct
{
	/// Message type (sitalMessageType_*).
	/// Equivalent DDC definition: wType
	U16BIT wType;
} sitalDecodedMessageStruct;




So to fix the issue with the function prototype,
> sitalDecodedMessageStructure* dmspDecodedMessage,
you either need to delete a few characters to use the typedef name
sitalDecodedMessageStruct* dmspDecodedMessage,
or use the full structure name with the struct keyword
struct sitalDecodedMessageStructure* dmspDecodedMessage,

Both are equivalent.
Thanks guys appreciate 🙏
Topic archived. No new replies allowed.