[英]Codeblocks IDE C programming - doesn't come with libraries?
我正在尝试在CodeBlocks IDE(在Windows上)中创建C程序,我需要的是库。 当我尝试构建并运行时,此行错误:
#include <sys/times.h>
我该怎么办? 那是Unix库吗? 我可以下载它并以某种方式将其添加到我的CodeBlocks环境中吗? 我的意思是,已经在那里。
感谢您的任何帮助。
从Code :: Blocks中的Settings
> Compiler and Debugger
> Compiler Options
中删除-ansi编译标志。 如果这样做没有帮助,则Windows下<sys/times.h>
不可用。
编辑 : sys/times.h
是POSIX库的一部分。 POSIX标头在MinGW下不可用,需要Cygwin。 time.h是标准的ANSI标头。 如果要在兼容POSIX的系统上继续使用sys/times.h
,可以采取以下措施来确保可移植性:
#ifdef __WIN32__
# include <time.h>
#else
# include <sys/times.h>
#endif
参考: time.h
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.