【发布时间】:2013-04-01 15:56:07
【问题描述】:
我在使用 minGW 的 g++.exe 编译一些 Linux C++ 代码时遇到了很大的困难。 具体来说,无法理解这段代码:
struct timespec now;
clock_gettime(CLOCK_REALTIME,&now);
我已经添加了必要的头文件
#include <ctime>
编译错误是:
error: aggregate 'special_time2()::timespec now' has incomplete type and cannot be defined
error: 'CLOCK_REALTIME' was not declared in this scope
error: 'clock_gettime' was not declared in this scope
有人知道为什么会发生这种情况并知道潜在的解决方法吗?
【问题讨论】: