help me with this program
I have written this program to print the voluntary and involuntary context switches. I am getting few errors. please help me to remove these errors
#include<stdio.h> #include<time.h> #include<stdint.h> #include<sys/time.h> #include<sys/resource.h> int main(int argc, char* argv[]) { struct rusage{ long ru_maxrss; long ru_ixrss; long ru_idrss; long ru_isrss; long ru_minflt; long ru_majflt; long ru_nswap; long ru_inblock; long ru_oublock; long ru_insgsnd; long ru_msgrcv; long ru_nsignals; long ru_nvcsw; long ru_nivcsw; }; rusage ru; getrusage(RUSAGE_SELF, &ru); printf("voluntary context switches%ld, involuntary context switches %ld",ru.ru_nvcsw,ru.ru_nivcsw); return 0; } I am using Turbo C++, I m getting few errors. I m getting errors on using three header files #include<stdint.h> #include<sys/time.h> #include<sys/resource.h> , and function getrusage() should have a prototype. and undefined symbol RUSAGE_SELF please help me to remove these errors |
Quote:
For the prototype message, you've not declared it (as in, putting "void getrusage.....") before entering main. And the undefined symbol is VERY obvious...you're using it, but haven't DEFINED IT ANYWHERE. Also...Turbo C++ is for Windows....the rusage things you're doing here appear to be pulled almost verbatim from the getrusage man page in Linux. |
duplicate, reported
|
All times are GMT -5. The time now is 05:54 PM. |