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?
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.