Wuesty
Hectopat
Arkadaşlar merhaba, oluşturduğum header dosyasında 3 tane "#include nested too deeply" hatası var, düzeltemiyorum. Yardımcı olur musunuz? Kod:
C++:
#include <time.h>
clock_t t0 = clock(); // read CPU time
/// do tasks ...
clock_t t1 = clock();
double cpu_time = (t1 - t0) / CLOCKS_PER_SEC;
#include <CPUclock.h>
CPUclock clock;
clock.init();
// perform tasks ...
double cpu_time = clock.getCPUtime();
...
/// perform more tasks
... double cpu_time2 = clock.getCPUtime();
// perform even more tasks
... double cpu_time3 = clock.getCPUtime();
class CPUclock
{
private:
clock_t t0;
public:
void init() { t0 = clock(); }
double getCPUtime()
{
double t0_end = clock();
double cpu = double((t0_end - t0) / CLOCKS_PER_SEC);
t0 = clock_t(t0_end);
return cpu;
}
};
#ifndef CPUclock_H
#define CPUclock_H
#include <time.h> // clock function
#ifdef HAS_TMS
#include <sys/times.h> // tms struct
#endif
class CPUclock
{
private:
clock_t t0;
#ifdef HAS_TMS
tms t1, diff;
double cpu_time, child_cpu_time;
#endif
public:
void init();
double getCPUtime();
};
#endif
Son düzenleyen: Moderatör: