C语言 time_t未在此范围内声明;您是指“size_t”吗?编译错误

erhoui1w  于 2022-12-11  发布在  其他
关注(0)|答案(1)|浏览(426)

它显示了你是说size_t在哪里使用了time_t,其他的在末尾显示了编译c文件时的错误
我尝试使用cygwin从github安装openplc代码,但显示以下错误信息

Generating object files...
In file included from Config0.c:6:
./lib/iec_std_lib.h: In function ‘TIME __time_mul(TIME, LREAL)’:
./lib/iec_std_lib.h:376:3: error: ‘time_t’ was not declared in this scope; did you mean ‘size_t’?
376 | time_t s = (time_t)s_f;
| ^~~~~~
| size_t
./lib/iec_std_lib.h:378:21: error: ‘s’ was not declared in this scope; did you mean ‘ns’?
378 | TIME res = {(long)s + ns.quot,
| ^
| ns
./lib/iec_std_lib.h: In function ‘TIME __time_div(TIME, LREAL)’:
./lib/iec_std_lib.h:385:3: error: ‘time_t’ was not declared in this scope; did you mean ‘size_t’?
385 | time_t s = (time_t)s_f;
| ^~~~~~
| size_t
./lib/iec_std_lib.h:386:21: error: ‘s’ was not declared in this scope
386 | TIME res = {(long)s,
| ^
./lib/iec_std_lib.h: In function ‘STRING __tod_to_string(TOD)’:
./lib/iec_std_lib.h:623:5: error: ‘time_t’ was not declared in this scope; did you mean ‘size_t’?
623 | time_t seconds;
| ^~~~~~
| size_t
./lib/iec_std_lib.h:625:5: error: ‘seconds’ was not declared in this scope
625 | seconds = IN.tv_sec;
| ^~~~~~~
Error compiling C files
Compilation finished with errors!
b4lqfgs4

b4lqfgs41#

您必须包含<time.h>time_t的定义才能让编译器看见。
错误消息有些令人困惑:编译器不知道time_t,但是它已经看到size_t的定义仅相差2个字母,因此它暗示了潜在的打字错误或程序员错误。

相关问题