c++ - Prolem including time.h, defining MSDOS
- Stefano (107/107) Feb 16 2006 Having solved (at least, i hope) the problems with atlas, i have a probl...
- Stefano (9/116) Feb 16 2006 I have solved the problem, as dtime_.c and etime_.c compiled fine if i d...
- Walter Bright (3/6) Feb 16 2006 Just pick WinNT.
Having solved (at least, i hope) the problems with atlas, i have a problem trying to compile clapack for windows. The two problematic files are: dtime_.c: ****************** #include "time.h" #ifdef MSDOS #undef USE_CLOCK #define USE_CLOCK #endif #ifndef USE_CLOCK #define _INCLUDE_POSIX_SOURCE /* for HP-UX */ #define _INCLUDE_XOPEN_SOURCE /* for HP-UX */ #include "sys/types.h" #include "sys/times.h" #endif #undef Hz #ifdef CLK_TCK #define Hz CLK_TCK #else #ifdef HZ #define Hz HZ #else #define Hz 60 #endif #endif double #ifdef KR_headers dtime_(tarray) float *tarray; #else dtime_(float *tarray) #endif { #ifdef USE_CLOCK #ifndef CLOCKS_PER_SECOND #define CLOCKS_PER_SECOND Hz #endif static double t0; double t = clock(); tarray[1] = 0; tarray[0] = (t - t0) / CLOCKS_PER_SECOND; t0 = t; return tarray[0]; #else struct tms t; static struct tms t0; times(&t); tarray[0] = (t.tms_utime - t0.tms_utime) / Hz; tarray[1] = (t.tms_stime - t0.tms_stime) / Hz; t0 = t; return tarray[0] + tarray[1]; #endif } *************** etime_.c: ************* #include "time.h" #ifdef MSDOS #undef USE_CLOCK #define USE_CLOCK #endif #ifndef USE_CLOCK #define _INCLUDE_POSIX_SOURCE /* for HP-UX */ #define _INCLUDE_XOPEN_SOURCE /* for HP-UX */ #include "sys/types.h" #include "sys/times.h" #endif #undef Hz #ifdef CLK_TCK #define Hz CLK_TCK #else #ifdef HZ #define Hz HZ #else #define Hz 60 #endif #endif double #ifdef KR_headers etime_(tarray) float *tarray; #else etime_(float *tarray) #endif { #ifdef USE_CLOCK #ifndef CLOCKS_PER_SECOND #define CLOCKS_PER_SECOND Hz #endif double t = clock(); tarray[1] = 0; return tarray[0] = t / CLOCKS_PER_SECOND; #else struct tms t; times(&t); return (tarray[0] = t.tms_utime/Hz) + (tarray[1] = t.tms_stime/Hz); #endif } ************** The problem is that when i compile i get: "size of tms not known" I have looked in c:\dm\lib\time.h but that didn't help me at all. Also, i need to define "MSDOS" (to be able to load the correct headers, instead of the unix ones), but setting _MSDOS in the project settings under build, defines doen's help at all. Where am i wrong? Thank you for your help :) Greetings Stefano
Feb 16 2006
I have solved the problem, as dtime_.c and etime_.c compiled fine if i define the MSDOS macro. I was having problems entering the MSDOS macro in the define section correctly, hope that the library will works ok, time will tell :) Also, i don't undestrand clearly the difference in choosing winNT vs win32 vs win95. Does it only affect the define macros or something more? Thank you! Stefano In article <dt2966$p6j$1 digitaldaemon.com>, Stefano says...Having solved (at least, i hope) the problems with atlas, i have a problem trying to compile clapack for windows. The two problematic files are: dtime_.c: ****************** #include "time.h" #ifdef MSDOS #undef USE_CLOCK #define USE_CLOCK #endif #ifndef USE_CLOCK #define _INCLUDE_POSIX_SOURCE /* for HP-UX */ #define _INCLUDE_XOPEN_SOURCE /* for HP-UX */ #include "sys/types.h" #include "sys/times.h" #endif #undef Hz #ifdef CLK_TCK #define Hz CLK_TCK #else #ifdef HZ #define Hz HZ #else #define Hz 60 #endif #endif double #ifdef KR_headers dtime_(tarray) float *tarray; #else dtime_(float *tarray) #endif { #ifdef USE_CLOCK #ifndef CLOCKS_PER_SECOND #define CLOCKS_PER_SECOND Hz #endif static double t0; double t = clock(); tarray[1] = 0; tarray[0] = (t - t0) / CLOCKS_PER_SECOND; t0 = t; return tarray[0]; #else struct tms t; static struct tms t0; times(&t); tarray[0] = (t.tms_utime - t0.tms_utime) / Hz; tarray[1] = (t.tms_stime - t0.tms_stime) / Hz; t0 = t; return tarray[0] + tarray[1]; #endif } *************** etime_.c: ************* #include "time.h" #ifdef MSDOS #undef USE_CLOCK #define USE_CLOCK #endif #ifndef USE_CLOCK #define _INCLUDE_POSIX_SOURCE /* for HP-UX */ #define _INCLUDE_XOPEN_SOURCE /* for HP-UX */ #include "sys/types.h" #include "sys/times.h" #endif #undef Hz #ifdef CLK_TCK #define Hz CLK_TCK #else #ifdef HZ #define Hz HZ #else #define Hz 60 #endif #endif double #ifdef KR_headers etime_(tarray) float *tarray; #else etime_(float *tarray) #endif { #ifdef USE_CLOCK #ifndef CLOCKS_PER_SECOND #define CLOCKS_PER_SECOND Hz #endif double t = clock(); tarray[1] = 0; return tarray[0] = t / CLOCKS_PER_SECOND; #else struct tms t; times(&t); return (tarray[0] = t.tms_utime/Hz) + (tarray[1] = t.tms_stime/Hz); #endif } ************** The problem is that when i compile i get: "size of tms not known" I have looked in c:\dm\lib\time.h but that didn't help me at all. Also, i need to define "MSDOS" (to be able to load the correct headers, instead of the unix ones), but setting _MSDOS in the project settings under build, defines doen's help at all. Where am i wrong? Thank you for your help :) Greetings Stefano
Feb 16 2006
"Stefano" <Stefano_member pathlink.com> wrote in message news:dt2hj7$12nd$1 digitaldaemon.com...Also, i don't undestrand clearly the difference in choosing winNT vs win32 vs win95. Does it only affect the define macros or something more?Just pick WinNT.
Feb 16 2006