0
votes

While trying to port floating-point C code to a fixed-point code, I came accross a problem in Eclipse CDT - indexer does not recognize f32 type which I am using to replace standard C float. The code compiles and builds fine (using MinGW GCC compiler). It's a mixture of C and C++ code.

It is annoying to see hundreds of warnings in Eclipse: Type f32 could not be resolved. This is how the type is defined in the 3rd party DSP library code:

#define B_(X) b_##X
... 
#define f32 B_(f32) 
... 
/* type declarations */

#define DECLARE_TYPE(s) \
    namespace s##_space { \
    class s##_; \
    } \
    typedef s##_space::s##_ s;
... 
DECLARE_TYPE(f32);
...
namespace f32_space 
{
    //etc...

Why wouldn't f32 type be recognized?

1
This works for me (or at least an approximate version of what you have put in here). Can you edit to make it minimal reproducible example? (To be specific, ae_f32 works, but ae_f32x2 does not, however the latter has no declaration in your question.) - Jonah Graham
Sorry, can't do compelte example... What do you mean by "works for me"? Eclipse doesn't report Type ae_f32 could not be resolved? ae_f32x2 is not important, only ae_f32 is. - Danijel
Yes, If I cut down your example and stick it in a new C++ project it just works for ae_f32. This is what I used in my cutdown: pastebin.com/KfmpEsbX - Jonah Graham
Thanks Jonah. Well, that just makes it more puzzling. - Danijel
Maybe the problem is the size of include file? The .h file has more than 30.000 lines. - Danijel

1 Answers

0
votes

Resolved it.

The problem was mixture of C and C++ in .c files. I have sources with .c extension that have ifdefed C++ code (#if defined(__cplusplus) etc), and also compiler is set to C++. Indexer however parses those files as C. When I generated indexer log file (Project\C C++ Index\Create Parser Log File), I noticed the following: Language: GNU C.

Then I added language mappings:

Settings\C C++ General\Language Mappings

  • C Header file map to C++
  • C Source file map to C++

Once I changed this, it works.