From: geier AT forwiss DOT uni-passau DOT de (Roland Geier) Subject: Where to find gettimeofday(), localtime()? 18 Jun 1997 06:56:33 -0700 Approved: cygnus DOT gnu-win32 AT cygnus DOT com Distribution: cygnus Message-ID: <199706181220.OAA20498.cygnus.gnu-win32@bombadill.forwiss.uni-passau.de> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Original-To: gnu-win32 AT cygnus DOT com X-Face: %JjDwL,CM#gbv*uICrNLdM9yk_LRxMh3DV'.fQ>iw'N;7([Jq}2|J#5o".kzM&>7tW`8T^Z buvRLp?jvQ+sbD3BND%=&D: lT%vT4p7cGcGRP5JO+F'^ X-Mailer: ELM [version 2.4ME+ PL31 (25)] Original-Sender: owner-gnu-win32 AT cygnus DOT com 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 #include #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".