- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have inherited some Visual Studio 6 vintage FORTRAN code with a thin C++ wrapper. Currently using Compaq FORTRAN 6.6 and VS2008 - and am trying to both get this working and also get budget to upgrade to Intel FORTRAN (which we are going to have to do sooner or later, maybe sooner to get 64 bit support, Windows7, etc, yes?)
The Fortran compiler command line is
fl32 /c /nologo /W1 /I.. /I. /4Yd /4Ya /DOS_WINDOWS /Od /Fm /Zi -c /Fo$(IntDir)\$(InputName).obj $(InputDir)$(InputName).for
I add these folders as VS2008 Linker Additional Library Directories
C:\Program Files\Microsoft Visual Studio\DF98\Lib
C:\Program Files\Microsoft Visual Studio 9.0\VC\lib
C:\Program Files\Microsoft Visual Studio\DF98\IMSL\Lib
1. At this point building gives me
fatal error LNK1104: cannot open file 'libc.lib'
2. If I tell the linker to ignore libc.lib I get a bunch of unresolved symbols from DFOR:
1>dfor.lib(intrin.obj) : error LNK2001: unresolved external symbol ___fastflag
1>dfor.lib(intrini.obj) : error LNK2019: unresolved external symbol ___fastflag referenced in function __FIIfexp
1>dfor.lib(for_m_qqs.obj) : error LNK2019: unresolved external symbol _errno referenced in function _flush_nonadv_buffers
1>dfor.lib(for_portlib.obj) : error LNK2001: unresolved external symbol _errno
1>dfor.lib(for_diags.obj) : error LNK2019: unresolved external symbol __iob referenced in function _for__perror
1>dfor.lib(for_diags.obj) : error LNK2019: unresolved external symbol __sys_nerr referenced in function _for__gerror@8
1>dfor.lib(for_io_util.obj) : error LNK2019: unresolved external symbol __pctype referenced in function _for__get_number_value
1>dfor.lib(for_init.obj) : error LNK2001: unresolved external symbol __pctype
1>dfor.lib(for_io_util.obj) : error LNK2019: unresolved external symbol ___mb_cur_max referenced in function _for__get_number_value
1>dfor.lib(for_init.obj) : error LNK2001: unresolved external symbol ___mb_cur_max
1>dfor.lib(for_init.obj) : error LNK2019: unresolved external symbol ___argv referenced in function _for_rtl_init_
1>dfor.lib(for_init.obj) : error LNK2019: unresolved external symbol ___argc referenced in function _for_rtl_init_
1>dfor.lib(for_init.obj) : error LNK2019: unresolved external symbol __pxcptinfoptrs referenced in function _GETEXCEPTIONPTRSQQ@0
3. If I add this folder as an Additional Library Directories (and remove my instruction to ignore libc)
C:\Program Files\Microsoft Visual Studio\VC98\LIB
I get these errors:
1>libc.lib(dllcrt0.obj) : error LNK2005: __CRT_INIT@12 already defined in MSVCRTD.lib(crtdll.obj)
1>libc.lib(dllcrt0.obj) : error LNK2005: __DllMainCRTStartup@12 already defined in MSVCRTD.lib(crtdll.obj)
1>libc.lib(dllcrt0.obj) : error LNK2005: __amsg_exit already defined in MSVCRTD.lib(MSVCR90D.dll)
1>libc.lib(fpinit.obj) : error LNK2005: __ldused already defined in a previous module
1>libc.lib(fpinit.obj) : error LNK2005: __fltused already defined in a previous module
1>libc.lib(crt0init.obj) : error LNK2005: ___xc_z already defined in MSVCRTD.lib(cinitexe.obj)
1>libc.lib(crt0init.obj) : error LNK2005: ___xc_a already defined in MSVCRTD.lib(cinitexe.obj)
1>libc.lib(crt0init.obj) : error LNK2005: ___xi_z already defined in MSVCRTD.lib(cinitexe.obj)
1>libc.lib(crt0init.obj) : error LNK2005: ___xi_a already defined in MSVCRTD.lib(cinitexe.obj)
1> Creating library .\Debug/stdspr.lib and object .\Debug/stdspr.exp
1>LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; use /NODEFAULTLIB:library
1>LINK : warning LNK4098: defaultlib 'libc.lib' conflicts with use of other libs; use /NODEFAULTLIB:library
Any advice on how to get this working would be appreciated - or if the answer is that I'm stuffed until I upgrade to the Intel compiler that would be good to know too!
TIA, Chris
The Fortran compiler command line is
fl32 /c /nologo /W1 /I.. /I. /4Yd /4Ya /DOS_WINDOWS /Od /Fm /Zi -c /Fo$(IntDir)\$(InputName).obj $(InputDir)$(InputName).for
I add these folders as VS2008 Linker Additional Library Directories
C:\Program Files\Microsoft Visual Studio\DF98\Lib
C:\Program Files\Microsoft Visual Studio 9.0\VC\lib
C:\Program Files\Microsoft Visual Studio\DF98\IMSL\Lib
1. At this point building gives me
fatal error LNK1104: cannot open file 'libc.lib'
2. If I tell the linker to ignore libc.lib I get a bunch of unresolved symbols from DFOR:
1>dfor.lib(intrin.obj) : error LNK2001: unresolved external symbol ___fastflag
1>dfor.lib(intrini.obj) : error LNK2019: unresolved external symbol ___fastflag referenced in function __FIIfexp
1>dfor.lib(for_m_qqs.obj) : error LNK2019: unresolved external symbol _errno referenced in function _flush_nonadv_buffers
1>dfor.lib(for_portlib.obj) : error LNK2001: unresolved external symbol _errno
1>dfor.lib(for_diags.obj) : error LNK2019: unresolved external symbol __iob referenced in function _for__perror
1>dfor.lib(for_diags.obj) : error LNK2019: unresolved external symbol __sys_nerr referenced in function _for__gerror@8
1>dfor.lib(for_io_util.obj) : error LNK2019: unresolved external symbol __pctype referenced in function _for__get_number_value
1>dfor.lib(for_init.obj) : error LNK2001: unresolved external symbol __pctype
1>dfor.lib(for_io_util.obj) : error LNK2019: unresolved external symbol ___mb_cur_max referenced in function _for__get_number_value
1>dfor.lib(for_init.obj) : error LNK2001: unresolved external symbol ___mb_cur_max
1>dfor.lib(for_init.obj) : error LNK2019: unresolved external symbol ___argv referenced in function _for_rtl_init_
1>dfor.lib(for_init.obj) : error LNK2019: unresolved external symbol ___argc referenced in function _for_rtl_init_
1>dfor.lib(for_init.obj) : error LNK2019: unresolved external symbol __pxcptinfoptrs referenced in function _GETEXCEPTIONPTRSQQ@0
3. If I add this folder as an Additional Library Directories (and remove my instruction to ignore libc)
C:\Program Files\Microsoft Visual Studio\VC98\LIB
I get these errors:
1>libc.lib(dllcrt0.obj) : error LNK2005: __CRT_INIT@12 already defined in MSVCRTD.lib(crtdll.obj)
1>libc.lib(dllcrt0.obj) : error LNK2005: __DllMainCRTStartup@12 already defined in MSVCRTD.lib(crtdll.obj)
1>libc.lib(dllcrt0.obj) : error LNK2005: __amsg_exit already defined in MSVCRTD.lib(MSVCR90D.dll)
1>libc.lib(fpinit.obj) : error LNK2005: __ldused already defined in a previous module
1>libc.lib(fpinit.obj) : error LNK2005: __fltused already defined in a previous module
1>libc.lib(crt0init.obj) : error LNK2005: ___xc_z already defined in MSVCRTD.lib(cinitexe.obj)
1>libc.lib(crt0init.obj) : error LNK2005: ___xc_a already defined in MSVCRTD.lib(cinitexe.obj)
1>libc.lib(crt0init.obj) : error LNK2005: ___xi_z already defined in MSVCRTD.lib(cinitexe.obj)
1>libc.lib(crt0init.obj) : error LNK2005: ___xi_a already defined in MSVCRTD.lib(cinitexe.obj)
1> Creating library .\Debug/stdspr.lib and object .\Debug/stdspr.exp
1>LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; use /NODEFAULTLIB:library
1>LINK : warning LNK4098: defaultlib 'libc.lib' conflicts with use of other libs; use /NODEFAULTLIB:library
Any advice on how to get this working would be appreciated - or if the answer is that I'm stuffed until I upgrade to the Intel compiler that would be good to know too!
TIA, Chris
1 Solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Probably the simplest solution is to add /MT (Multithread static library) to your Fortran command (fl32). Make sure that your C compile also specifies this. /MD (multithread DLL) is an alternative.
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Probably the simplest solution is to add /MT (Multithread static library) to your Fortran command (fl32). Make sure that your C compile also specifies this. /MD (multithread DLL) is an alternative.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Steve Lionel (Intel)
Probably the simplest solution is to add /MT (Multithread static library) to your Fortran command (fl32). Make sure that your C compile also specifies this. /MD (multithread DLL) is an alternative.
Many thanks Steve, that has fixed those build problems ( /MD was what I needed). I have a couple of other issues which I think are unrelated and then we get to see what happens when I run it ;-)

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page