I'm trying to create a C program in the CodeBlocks IDE (on Windows), and something I need is the library . When I try and build and run, this line errors:
#include <sys/times.h>
What do I do? Is that a Unix library? Can I download it and just add it somehow to my CodeBlocks environment? I mean, is already there.
Thank you for any help.
Remove -ansi compilation flag from Settings
> Compiler and Debugger
> Compiler Options
in Code::Blocks. If that does not help, <sys/times.h>
is unavailable under Windows.
Edit : sys/times.h
is a part of the POSIX library. POSIX headers are not available under MinGW, and need Cygwin. time.h is a standard ANSI header. If you want to continue using sys/times.h
on POSIX-compliant systems, what you could do instead to ensure portability is
#ifdef __WIN32__
# include <time.h>
#else
# include <sys/times.h>
#endif
Reference: time.h
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.