Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
New User
11 Views

IMSL Version 6 linking errors

Jump to solution
I am migrating a CVF application to Win32 IVF wit VS2013. When linking I get the messages: 1>Linking... 1>LIBCMT.lib(invarg.obj) : error LNK2005: "void __cdecl _invalid_parameter(unsigned short const *,unsigned short const *,unsigned short const *,unsigned int,unsigned int)" (?_invalid_parameter@@YAXPBG00II@Z) already defined in LIBCMTD.lib(invarg.obj) 1>LIBCMT.lib(invarg.obj) : error LNK2005: "void __cdecl _invoke_watson(unsigned short const *,unsigned short const *,unsigned short const *,unsigned int,unsigned int)" (?_invoke_watson@@YAXPBG00II@Z) already defined in LIBCMTD.lib(invarg.obj) 1>LIBCMT.lib(invarg.obj) : error LNK2005: __call_reportfault already defined in LIBCMTD.lib(invarg.obj) 1>LIBCMT.lib(invarg.obj) : error LNK2005: __get_invalid_parameter_handler already defined in LIBCMTD.lib(invarg.obj) 1>LIBCMT.lib(invarg.obj) : error LNK2005: __initp_misc_invarg already defined in LIBCMTD.lib(invarg.obj) 1>LIBCMT.lib(invarg.obj) : error LNK2005: __invalid_parameter already defined in LIBCMTD.lib(invarg.obj) 1>LIBCMT.lib(invarg.obj) : error LNK2005: __invoke_watson already defined in LIBCMTD.lib(invarg.obj) 1>LIBCMT.lib(invarg.obj) : error LNK2005: __set_invalid_parameter_handler already defined in LIBCMTD.lib(invarg.obj) 1>LIBCMT.lib(invarg.obj) : error LNK2005: ___pInvalidArgHandler already defined in LIBCMTD.lib(invarg.obj) 1>LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library 1>Debug/CaFeMS1-IVF.exe : fatal error LNK1169: one or more multiply defined symbols found I have followed the advises given in the document "Installing and using the IMSL libraries" by Steve. This document was updated April 18, 2016 so it might not be valid for the program versions I have ? My compiler is from: w_fcompxe_2013_sp1.1.139 Intel(R) Visual Fortran Compiler XE for IA-32, version 14.0.4 Package ID: w_fcompxe_2013_sp1.4.237 IMSL from : w_fcompxe_imsl_2013_sp1.0.003 In the main program, I put INCLUDE 'link_fnl_static.h' !DEC$ OBJCOMMENT LIB: 'LIBIOMP5MD.LIB' Include files are: $(IFortInstallDir)compiler\include $(IFortInstallDir)compiler\include\ia32 $(IFortInstallDir)mkl\include $(VCInstallDir)atlmfc\include $(VCInstallDir)include $(WindowsSdkDir)include\um $(WindowsSdkDir)include\shared $(FrameworkSDKDir)include $(FNL_DIR)\IA32\include\dll Library files are: $(IFortInstallDir)compiler\lib\ia32 $(IFortInstallDir)mkl\lib\ia32 $(VCInstallDir)atlmfc\lib $(VCInstallDir)lib $(WindowsSdkDir)lib\winv6.3\um\x86 $(FrameworkSDKDir)lib $(FNL_DIR)\IA32\lib Can anybody give me a tip ?
0 Kudos

Accepted Solutions
Highlighted
Black Belt Retired Employee
11 Views

Your problem has nothing to do with IMSL.

For example, your log shows:

    Searching C:\DVFORTRAN\PCLIBDF\Debug\PCLIBDF_.lib:
      Found _FILNAM
        Referenced in TVRR46_E.obj
        Referenced in Plotgraph.obj
        Loaded PCLIBDF_.lib(Inut.obj)
Processed /DEFAULTLIB:LIBCMT

Library PCLIBDF_.lib was built to link against non-debug C libraries, so it tries pulling in LIBCMT. Because you have /dbglibs set in your Fortran project, that pulls in LIBCMTD and sets you up for a conflict.

The easiest solution is most likely to change your Fortran project to not use /dbglibs . I note that you are also using /libs:qwin - I can't find a way to make the Visual Fortran project system set both /libs:qwin and /dbglibs unless you manually add one of these to the Command Line property page.

You have a lot of possibly unnecessary options as well, such as /f77rtl and /4yportlib.

View solution in original post

0 Kudos
9 Replies
Highlighted
Black Belt
11 Views

My guess (since you have not shown us the commands/options used to compile and link) is that you specified debug-libraries when compiling at least one source file, or you are using a third-party library (other than IMSL) that was compiled with debug libraries (or /MTd) specified.

You may use the linker option /nodefaultlib:LIBCMTD.LIB, but it is better to find and fix the build configuration to prevent the dependency on the debug libraries from occurring.

0 Kudos
Highlighted
New User
11 Views

Of course, the full log-file is shown below:

Compiling with Intel(R) Visual Fortran Compiler XE 14.0.4.237 [IA-32]...
ifort /nologo /debug:full /Od /f77rtl /intconstant /warn:interfaces /double_size:128 /Qsave /Qzero /fp:precise /iface:mixed_str_len_arg /module:"Debug/" /object:"Debug/" /Fd"Debug\vc120.pdb" /traceback /check:bounds /libs:qwin /dbglibs /4Yportlib /c /Qvc12 /Qlocation,link,"C:\Program Files (x86)\VC\\bin" "C:\CALC\CaFeMS\Main_elast6b.f90"
ifort: command line warning #10212: /fp:precise evaluates in source precision with Fortran.

Linking...
Link /OUT:"Debug/CaFeMS1-IVF.exe" /INCREMENTAL:NO /NOLOGO /MANIFEST /MANIFESTFILE:"C:\CALC\CaFeMS\Debug\CaFeMS1-IVF.exe.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"Debug/CaFeMS1.pdb" /SUBSYSTEM:WINDOWS /STACK:6000000 /ENTRY:"WinMainCRTStartup" /IMPLIB:"C:\CALC\CaFeMS\Debug\CaFeMS1-IVF.lib" kernel32.lib /MACHINE:I386 "Debug/Moduldata.obj" "Debug/TVRR46_E.obj" "Debug/Fortran_WinPrint_Direct.obj" "Debug/Mich.obj" "Debug/Elasub6.obj" "Debug/ASCIIDBASE.obj" "Debug/SectionData.obj" "Debug/messageboxes.obj" "Debug/Editdata.obj" "Debug/Plotgraph.obj" "Debug/Main_elast6b.obj" "Debug/EDITASSEMBLY.obj" "Debug/PcgrafCVF_old.obj" "Debug/Getopenfilename.obj" "Debug/Dialogs_E6.obj" "Debug/MOVEMENTS.obj" "Debug/FreqSweep.obj" "Debug/DBASE_Operations.obj" "Debug/CalcNatFreq.obj" "Debug/Resource1.res" "Debug/ELAST6.res" "C:\DVFORTRAN\PCLIBDF\Debug\PCLIBDF_.lib"
Link: executing 'link'
LIBCMT.lib(invarg.obj) : error LNK2005: "void __cdecl _invalid_parameter(unsigned short const *,unsigned short const *,unsigned short const *,unsigned int,unsigned int)" (?_invalid_parameter@@YAXPBG00II@Z) already defined in LIBCMTD.lib(invarg.obj)
LIBCMT.lib(invarg.obj) : error LNK2005: "void __cdecl _invoke_watson(unsigned short const *,unsigned short const *,unsigned short const *,unsigned int,unsigned int)" (?_invoke_watson@@YAXPBG00II@Z) already defined in LIBCMTD.lib(invarg.obj)
LIBCMT.lib(invarg.obj) : error LNK2005: __call_reportfault already defined in LIBCMTD.lib(invarg.obj)
LIBCMT.lib(invarg.obj) : error LNK2005: __get_invalid_parameter_handler already defined in LIBCMTD.lib(invarg.obj)
LIBCMT.lib(invarg.obj) : error LNK2005: __initp_misc_invarg already defined in LIBCMTD.lib(invarg.obj)
LIBCMT.lib(invarg.obj) : error LNK2005: __invalid_parameter already defined in LIBCMTD.lib(invarg.obj)
LIBCMT.lib(invarg.obj) : error LNK2005: __invoke_watson already defined in LIBCMTD.lib(invarg.obj)
LIBCMT.lib(invarg.obj) : error LNK2005: __set_invalid_parameter_handler already defined in LIBCMTD.lib(invarg.obj)
LIBCMT.lib(invarg.obj) : error LNK2005: ___pInvalidArgHandler already defined in LIBCMTD.lib(invarg.obj)
LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
Debug/CaFeMS1-IVF.exe : fatal error LNK1169: one or more multiply defined symbols found


CaFeMS1_ - 10 error(s), 2 warning(s)
0 Kudos
Highlighted
Black Belt Retired Employee
11 Views

Your "screenshot" cut off some of the command line and error messages, but mecej4 has the right idea.  If you would attach a zip of the buildlog.htm from the Debug folder we might spot another clue. Normally it isn't a problem to link in IMSL's static library with debug C libraries, so something else is going on.

0 Kudos
Highlighted
Black Belt
11 Views

You posted the log file in-line, and many lines have been trimmed, so important information is missing.

In #1, you showed a list of library directories, but did not show the actual libraries that the linker should have searched.

Do you have any C source files in your project (or in a C DLL project that is related to the Fortran project)? Some of those C files were probably compiled with /MTd.

0 Kudos
Highlighted
New User
11 Views

Thank you for response, Steve, Find attached log-file..

0 Kudos
Highlighted
Black Belt Retired Employee
11 Views

This is only the link step, but I see a lot of "interestingly named" objects and libraries in the link line - with CVF and DVF in names. You need to make sure that all objects and libraries were built with the same setting for the run-time libraries (static vs. dynamic, Debug vs. non-debug).

If you enable the property Linker > General > Show Progress > Show all progress messages, the build log will have more detail about what is being referenced from where.

Basically, I see that something is pulling in the C/C++ "invalid parameter" checking functions and one version of it has already been pulled in from LIBCMT but another is looked for in LIBCMTD. The "progress" messages will be able to tell you where.

0 Kudos
Highlighted
New User
11 Views

Thanks again. I attach a revised zip file that will show more details...

0 Kudos
Highlighted
Black Belt Retired Employee
12 Views

Your problem has nothing to do with IMSL.

For example, your log shows:

    Searching C:\DVFORTRAN\PCLIBDF\Debug\PCLIBDF_.lib:
      Found _FILNAM
        Referenced in TVRR46_E.obj
        Referenced in Plotgraph.obj
        Loaded PCLIBDF_.lib(Inut.obj)
Processed /DEFAULTLIB:LIBCMT

Library PCLIBDF_.lib was built to link against non-debug C libraries, so it tries pulling in LIBCMT. Because you have /dbglibs set in your Fortran project, that pulls in LIBCMTD and sets you up for a conflict.

The easiest solution is most likely to change your Fortran project to not use /dbglibs . I note that you are also using /libs:qwin - I can't find a way to make the Visual Fortran project system set both /libs:qwin and /dbglibs unless you manually add one of these to the Command Line property page.

You have a lot of possibly unnecessary options as well, such as /f77rtl and /4yportlib.

View solution in original post

0 Kudos
Highlighted
New User
11 Views

Following your advise and switched Runtime library to QuickWin (/libs:qwin). Problem solved!

0 Kudos