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.
#ifdef SOMETHING
typedefstruct {
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?
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?
> 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.
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.
> 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.
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,