Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Linker error

reidar
New User
545 Views

I am converting a QW program from CVF to IVF with VS2013.  When I try to build, I receive several error messages I do not understand. Please see blow. Can someone give me a tip?


       Build Log

         Build started: Project: CaFeMS1_, Configuration: Debug|Win32

       Output

       
Compiling with Intel(R) Visual Fortran Compiler XE 14.0.4.237 [IA-32]...
ifort /nologo /debug:full /Od /Qsave /iface:cvf /module:"Debug/" /object:"Debug/" /Fd"Debug\vc120.pdb" /traceback /check:bounds /libs:qwin /dbglibs /winapp /c /Qvc12 /Qlocation,link,"C:\Program Files (x86)\VC\\bin" "C:\CALC\CaFeMS\Moduldata.f90"
ifort /nologo /debug:full /Od /Qsave /iface:cvf /module:"Debug/" /object:"Debug/" /Fd"Debug\vc120.pdb" /traceback /check:bounds /libs:qwin /dbglibs /winapp /c /Qvc12 /Qlocation,link,"C:\Program Files (x86)\VC\\bin" "C:\CALC\CaFeMS\Fortran_WinPrint_Direct.f90"
ifort /nologo /debug:full /Od /Qsave /iface:cvf /module:"Debug/" /object:"Debug/" /Fd"Debug\vc120.pdb" /traceback /check:bounds /libs:qwin /dbglibs /winapp /c /Qvc12 /Qlocation,link,"C:\Program Files (x86)\VC\\bin" "C:\CALC\CaFeMS\TVRR46_E.for"
C:\CALC\CaFeMS\TVRR46_E.for(34): remark #6375: Because of COMMON, the alignment of object is inconsistent with its type - potential performance impact   [TXTFONT]
 INTEGER TXTFONT,LMAX

.

ifort /nologo /debug:full /Od /Qsave /iface:cvf /module:"Debug/" /object:"Debug/" /Fd"Debug\vc120.pdb" /traceback /check:bounds /libs:qwin /dbglibs /winapp /c /Qvc12 /Qlocation,link,"C:\Program Files (x86)\VC\\bin" "C:\CALC\CaFeMS\Main_elast6b.f90"
Linking...
Link /OUT:"Debug/CaFeMS1-IVF.exe" /INCREMENTAL:NO /NOLOGO /NODEFAULTLIB:"dfconsol.lib" /MANIFEST /MANIFESTFILE:"C:\CALC\CaFeMS\Debug\CaFeMS1-IVF.exe.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"Debug/CaFeMS1.pdb" /SUBSYSTEM:WINDOWS /ENTRY:"WinMainCRTStartup" /IMPLIB:"C:\CALC\CaFeMS\Debug\CaFeMS1-IVF.lib" kernel32.lib /MACHINE:I386 "Debug/Moduldata.obj" "Debug/Fortran_WinPrint_Direct.obj" "Debug/TVRR46_E.obj" "Debug/Plotgraph.obj" "Debug/Getopenfilename.obj" "Debug/PcgrafCVF_old.obj" "Debug/FreqSweep.obj" "Debug/EDITASSEMBLY.obj" "Debug/MOVEMENTS.obj" "Debug/Dialogs_E6.obj" "Debug/Mich.obj" "Debug/Elasub6.obj" "Debug/CalcNatFreq.obj" "Debug/DBASE_Operations.obj" "Debug/messageboxes.obj" "Debug/SectionData.obj" "Debug/Editdata.obj" "Debug/ASCIIDBASE.obj" "Debug/Main_elast6b.obj" "Debug/Resource1.res" "Debug/ELAST6.res" "C:\DVFORTRAN\PCLIBDF\Release\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
FreqSweep.obj : error LNK2019: unresolved external symbol _DLSACG@24 referenced in function _FREQSWEEP
Debug/CaFeMS1-IVF.exe : fatal error LNK1120: 1 unresolved externals


CaFeMS1_ - 11 error(s), 21 warning(s)

0 Kudos
1 Solution
mecej4
Honored Contributor III
545 Views

Some of your objects depend on LIBCMT.lib and some others on LIBCMTD.lib; linking these causes multiple definitions to occur.

My suspicion is that the library C:\DVFORTRAN\PCLIBDF\Release\PCLIBDF_.lib was compiled without /dbglibs. If so, and you have the sources for that library, recompile the library with /dbglibs. If not, do not specify /dbglibs when compiling your sources in C:\CALC\CaFeMS.

View solution in original post

0 Kudos
3 Replies
mecej4
Honored Contributor III
546 Views

Some of your objects depend on LIBCMT.lib and some others on LIBCMTD.lib; linking these causes multiple definitions to occur.

My suspicion is that the library C:\DVFORTRAN\PCLIBDF\Release\PCLIBDF_.lib was compiled without /dbglibs. If so, and you have the sources for that library, recompile the library with /dbglibs. If not, do not specify /dbglibs when compiling your sources in C:\CALC\CaFeMS.

0 Kudos
reidar
New User
545 Views

Thank you for your comments, meceg4.

The /dbglibs is for debugging purposes, right? It  was my believe you could build using  obj files compiled with or without the above /dbglibs, but then, in case of stepping into a routine in the PCLIBDF_lib would get a  message telling that the code is not available.. Buts that is not correct...

0 Kudos
Steve_Lionel
Honored Contributor III
545 Views

/dbglibs simply means that you want to link against the debug version of the MSVC libraries. (There are debug versions of the ifort libraries but they are there just so that the MSVC debug libraries can be used.) The MSVC debug libraries enable you to step into the MSVC library code (if you have installed the CRT sources) and, perhaps most important, adds consistency checks to malloc/free to warn you against some memory allocation errors. 

Unlike for Fortran, the C compiler generates different code when /dbglibs is on, so if you have a mixed-language application you need to make sure that all the projects set this option consistently. Finally (I think), the debug libraries are not redistributable, so if you are building an app to be run on a different computer, be sure to do a Release build or at least turn off /dbglibs consistently.

0 Kudos
Reply