3

My eclipse does red-underline to uint32_t, uint16_t, etc... though I included <stdint.h> and set preprocessor path!

To know why it happens, I looked in <stdint.h>.

#ifndef _GCC_WRAP_STDINT_H
#if __STDC_HOSTED__
# if defined __cplusplus && __cplusplus >= 201103L
#  undef __STDC_LIMIT_MACROS
#  define __STDC_LIMIT_MACROS
#  undef __STDC_CONSTANT_MACROS
#  define __STDC_CONSTANT_MACROS
# endif
# include_next <stdint.h>        // here
#else
# include "stdint-gcc.h"
#endif
#define _GCC_WRAP_STDINT_H
#endif

Um, I think it seems that eclipse can't recognize #include_next. But I don't know solution.. Could you give me a advice?

ikh
  • 10,119
  • 1
  • 31
  • 70
  • Is it a C or a C++ project? – Ali Apr 27 '14 at 10:47
  • @Ali C. but I guess there's the same problem in C++ project... – ikh Apr 28 '14 at 09:49
  • 1
    In C++ there is a well-known issue, see http://stackoverflow.com/q/13458396/341970 but in C I don't know. The answer there doesn't seem to apply to your case. Sorry, I cannot help. :( – Ali Apr 28 '14 at 09:55

1 Answers1

1

First, to avoid #include_next, we should tell eclipse that __STDC_HOSTED__ is 0. In Project > Properties > C/C++ General > Path and Symbols, add __STDC_HOSTED__ as 0.

Second, you can see some codes like the following in stdint-gcc.h.

#ifdef __INT8_TYPE__
typedef __INT8_TYPE__ int8_t;
#endif

__INT8_TYPE__ things are predefined macros of gcc. We must tell eclipse about them as well. So, add all macros from gcc -E -dM - < /dev/null except __STDC_HOSTED__ which we added before.

Community
  • 1
  • 1
ikh
  • 10,119
  • 1
  • 31
  • 70