-------------------------------
/usr/include/sys/time.h: 関数 ‘second’ 内:
/usr/include/sys/time.h:70:1: エラー: 関数 ‘bintime_addx’ 用の無効な記憶域クラスです
bintime_addx(struct bintime *_bt, uint64_t _x)
^
/usr/include/sys/time.h:81:1: エラー: 関数 ‘bintime_add’ 用の無効な記憶域クラスです
bintime_add(struct bintime *_bt, const struct bintime *_bt2)
^
/usr/include/sys/time.h:93:1: エラー: 関数 ‘bintime_sub’ 用の無効な記憶域クラスです
bintime_sub(struct bintime *_bt, const struct bintime *_bt2)
以下略
-------------------------------
どうやらCygwinはデフォルトでエラーメッセージが日本語らしい.
このままだと検索してもあまり情報が出てこないので,Japanese messages for GNU gccを参照して英語のメッセージを探す.
-------------------------------
#: c-decl.c:5930 c-decl.c:5941 c-decl.c:5944
#, gcc-internal-format
msgid "invalid storage class for function %qE"
msgstr "関数 %qE 用の無効な記憶域クラスです"
-------------------------------
英語で検索しても再現しているところはなかった.
とりあえず原因を見に行く.
time.hで
#if __BSD_VISIBLE
以下で呼ばれている部分で詰まっている模様.
この__BSD_VISIBLEは,cdefs.hで定義されている.
#if defined(_ANSI_SOURCE) /* Hide almost everything. */
#define __POSIX_VISIBLE 0
#define __XSI_VISIBLE 0
#define __BSD_VISIBLE 0
#define __ISO_C_VISIBLE 1990
#elif defined(_C99_SOURCE) /* Localism to specify strict C99 env. */
#define __POSIX_VISIBLE 0
#define __XSI_VISIBLE 0
#define __BSD_VISIBLE 0
#define __ISO_C_VISIBLE 1999
#elif defined(_C11_SOURCE) /* Localism to specify strict C11 env. */
#define __POSIX_VISIBLE 0
#define __XSI_VISIBLE 0
#define __BSD_VISIBLE 0
#define __ISO_C_VISIBLE 2011
#else /* Default: everything except __GNU_VISIBLE. */
#define __POSIX_VISIBLE 200809
#define __XSI_VISIBLE 700
#define __BSD_VISIBLE 1
#define __ISO_C_VISIBLE 2011
#endif
おそらくここでDefaultになっており,__BSD_VISIBLEが立っているのだろう.つまり,Default以外にすればよさそうだ.
コンパイルオプションに -D_C99_SOURCE を追加するとコンパイル・実行できるようになった.
0 件のコメント:
コメントを投稿