This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Where to find gettimeofday(), localtime()?


Hi!

I'm currently working on a port of some date/time-Classes from Unix to
NT. The time-class 'class Time' uses the functions 'gettimeofday' and
'localtime'. Therefore I *do* include 'time.h' and 'sys/time.h' in the
'Time.cc'-source-file, but have to declare the functions 'localtime'
and 'gettimeofday' to be of external linkage explicitly to get the
file compiled without warnings:

-------------------- snip --------------------
:
:
#include <time.h>
#include <sys/time.h>

#ifdef  __CYGWIN32__
    extern struct tm *localtime(time_t *timer);
    extern int gettimeofday(struct timeval*, struct timezone*);
#endif
:
-------------------- snip --------------------

I guess that's not how it should be :-(. The subseqent link-call

> ld.exe --verbose --dll -o DateTime.dll -e _dll_entry@12 \
> -LC:\Programme\gnuwin32\b18\H-i386-cygwin32\lib\gcc-lib\i386-cygwin32\cygnus-2.7.2-970404 \
> -LC:/Programme/gnuwin32/b18/H-i386-cygwin32/lib/gcc-lib \
> -LC:/Programme/gnuwin32/b18/H-i386-cygwin32/lib/gcc-lib/i386-cygwin32/cygnus-2.7.2-970404/../../../../i386-cygwin32/lib \
> -LC:/Programme/gnuwin32/b18/H-i386-cygwin32/lib/gcc-lib/i386-cygwin32/cygnus-2.7.2-970404/../../.. \
> -LC:/Programme/gnuwin32/b18/H-i386-cygwin32/lib/gcc-lib/i386-cygwin32/cygnus-2.7.2-970404 \
> --base-file=tmp.base Date.o DateTimePkgInit.o Month.o Time.o TinyTime.o WeekDay.o Year.o fixup.o \
> libtcl76.a -lstdc++ -lcygwin -lgcc -lkernel32

to generate a dll produces the following undefined-reference-errors:

> Time.o: In function `Time::Initialize(void)':
> //majestix/geier/project/packages/cms++-2.0/src/types/Time.cc:62: undefined refe
> rence to `gettimeofday(timeval *, timezone *)'
> Time.o: In function `Time::Now(void)':
> //majestix/geier/project/packages/cms++-2.0/src/types/Time.cc:70: undefined refe
> rence to `gettimeofday(timeval *, timezone *)'
> Time.o: In function `Time::BreakDown(int &, WeekDay &, Month &, int &, int &, in
> t &, int &, int &) const':
> //majestix/geier/project/packages/cms++-2.0/src/types/Time.cc:99: undefined refe
> rence to `localtime(long *)'
> C:/Programme/gnuwin32/b18/H-i386-cygwin32/lib/gcc-lib/i386-cygwin32/cygnus-2.7.2
> -970404/../../../../i386-cygwin32/lib/libcygwin.a(libcmain.o)(.text+0x1e):libcma
> in.cc: undefined reference to `WinMain@16'

Could someone tell me what libraries are to be linked to get the two
time-related functions referenced correctly? What about the undefined
reference to 'WinMain@16'???

Thx in advance,

--- Roland.

---
Roland Geier                    Phone: ++49 (8505) 92181          
Universitaet Passau, GER 	Fax:   ++49 (8505) 922311
Lehrstuhl Prof. Dr. Donner      geier@forwiss.uni-passau.de	
D-94032 Passau                  http://www.uni-passau.de/~geier/

-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]