Mail Archives: cygwin/1997/06/18/06:56:33
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 AT 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 AT 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 AT 16'???
Thx in advance,
--- Roland.
---
Roland Geier Phone: ++49 (8505) 92181
Universitaet Passau, GER Fax: ++49 (8505) 922311
Lehrstuhl Prof. Dr. Donner geier AT forwiss DOT uni-passau DOT 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 AT cygnus DOT com" with one line of text: "help".
- Raw text -