I'm trying to port some very old fortran code to windows. I'd like to use mingw and f2c, which has no problem converting the code to usable C on OS X and Ubuntu. I used f2c.exe as distributed by netlib on a fresh install of mingw, and it translated the code fine. I have a "ported" version of libf2c that seems to still contain some unresolved references -- mostly file i/o routines (do_fio
, f_open
, s_wsfe
, e_wsfe
) and, peculiarly, one arithmetic routine (pow_dd开发者_如何学Python
). To resolve these issues, I tried to build libf2c from source, but ran into an issue during the make process. The make proceeds to dtime_.c
, but then fails due to a dependency on sys/times.h
, which is no longer a part of the mingw distro. There appears to be a struct
defined in times.h
that defines the size of a variable in dtime_.c
, specifically t
and t0
on lines 53 and 54 (error is "storage size of 't' isn't known"; same for t0
).
The makefile
was modified to use gcc, and make invoked with no other options passed.
Might anyone know of a workaround for this issue? I feel confident that once I have a properly compiled libf2c, I'll be able to link it with gcc and the code will work like it does on linux and os X.
FOLLOW-UP: I was able to build libf2c.a
by commenting out the time related files in the makefile
(my code does not contain any time related functions, so don't think it will matter). I copied it to a non-POSIX search directory as show in -print-search-dirs, specifically C:\MinGW\lib\gcc\mingw32\3.4.5. That seems to have fixed the issue on the unresolved references, although the need to eliminate the time files does concern me. While my code is now working, the original question stands -- how to handle makefiles that call for sys/times.h
in mingw?
Are you sure the MinGW installation went correct? As far as I can tell the sys/times.h
header is still there, in the package mingwrt-3.18-mingw32-dev.tar.gz
. I'm not familiar with the gui installer, but perhaps you have to tick a box for the mingwrt dev
component.
精彩评论