ETrobocon / RasPike

11 stars 11 forks source link

stringを読み込むとalignof/offsetofでコンパイルエラーとなる #22

Closed ytoi closed 2 months ago

ytoi commented 2 months ago

app.cで

#include <string>

と書くと、以下の様なエラーが出る。

../../include/t_stddef.h:221:32: error: template definition of non-template ‘struct std::alignment_of<_Tp>::<unnamed>’
  221 | #define alignof(type) offsetof(struct { char field1; type field2; }, field2)
      |                                ^~~~~~
../../include/t_stddef.h:221:39: error: types may not be defined within ‘__builtin_offsetof’
  221 | #define alignof(type) offsetof(struct { char field1; type field2; }, field2)
      |                                       ^
../../include/t_stddef.h:221:39: error: types may not be defined within ‘__builtin_offsetof’
  221 | #define alignof(type) offsetof(struct { char field1; type field2; }, field2)

t_stddef.hでC++のチェックをいれる