当我在我的代码片段中使用clock_gettime,并使用标志-std = c99进行编译时,我收到如下错误:
warning: implicit declaration of function 'clock_gettime'
error: 'CLOCK_REALTIME' undeclared (first use in this function)
Run Code Online (Sandbox Code Playgroud)
我已经包含了'time.h'文件.任何人都知道如何解决它.
在原始代码中使用-std = c99,尝试添加
#define _POSIX_C_SOURCE >= 199309L
Run Code Online (Sandbox Code Playgroud)
clock_gettime的手册页表明这是必要的功能测试宏要求.