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

Command Line Linker settings???

jbalster
Novice
507 Views
I have a mixed language project where the F77 (.for) code has to be run thru 2 pre-processors before it can be compiled with IVF. The other language is C++.I am running both of the pre-processors plus the IFORT.exe from a custom build rule. The project was already a .NET project setup with CVF instead of IVF so I changed the DF command to IFORT and copied switch settings fromanother project. The compile goes fine, but then when it tries to link, it can't find any of the fortran libraries so I get linker errors like

LINK : warning LNK4199: /DELAYLOAD:OleAcc.dll ignored; no imports found from OleAcc.dll

simdefSYS.obj : error LNK2019: unresolved external symbol _for_set_reentrancy referenced in function _MAIN__

simdefSYS.obj : error LNK2019: unresolved external symbol _for_date referenced in function _MAIN__

simdefSYS.obj : error LNK2019: unresolved external symbol _for_time referenced in function _MAIN__

simdefSYS.obj : error LNK2019: unresolved external symbol _for_concat referenced in function _MAIN__

libe.lib(NUM2CH.obj) : error LNK2001: unresolved external symbol _for_concat

simdefSYS.obj : error LNK2019: unresolved external symbol _for_write_seq_fmt referenced in function _MAIN__

simdefSYS.obj : error LNK2019: unresolved external symbol _for_exit referenced in function _MAIN__

simdefSYS.obj : error LNK2019: unresolved external symbol _for_open referenced in function _MAIN__

simdefSYS.obj : error LNK2019: unresolved external symbol _for_cpstr referenced in function _MAIN__

libe.lib(CH2NUM.obj) : error LNK2001: unresolved external symbol _for_cpstr

simdefSYS.obj : error LNK2019: unresolved external symbol _for_inquire referenced in function _MAIN__

simdefSYS.obj : error LNK2019: unresolved external symbol _for_write_dir_i8 referenced in function _COMDEK

libe.lib(WBLK.obj) : error LNK2001: unresolved external symbol _for_write_dir_i8

simdefSYS.obj : error LNK2019: unresolved external symbol _for_cpystr referenced in function _COMDEK

libe.lib(NUM2CH.obj) : error LNK2001: unresolved external symbol _for_cpystr

libe.lib(CH2NUM.obj) : error LNK2001: unresolved external symbol _for_cpystr

simdefSYS.obj : error LNK2019: unresolved external symbol _for_f90_index referenced in function _COMDEK

simdefSYS.obj : error LNK2019: unresolved external symbol _memmove referenced in function _COMDEK

simdefSYS.obj : error LNK2019: unresolved external symbol _for_write_seq_lis referenced in function _DESCRP

simdefSYS.obj : error LNK2019: unresolved external symbol __alloca_probe referenced in function _DESCRP

simdefSYS.obj : error LNK2019: unresolved external symbol _for_read_seq_fmt referenced in function _DESCRP

simdefSYS.obj : error LNK2019: unresolved external symbol _for_close referenced in function _DESCRP

simdefSYS.obj : error LNK2019: unresolved external symbol _for_stop_core referenced in function _DESCRP

simdefSYS.obj : error LNK2019: unresolved external symbol _for_write_seq_fmt_xmit referenced in function _DESCRP

LINK : error LNK2001: unresolved external symbol _mainCRTStartup

libe.lib(RBLK.obj) : error LNK2019: unresolved external symbol _for_read_dir_i8 referenced in function _RBLK

libe.lib(HPSORT.obj) : error LNK2001: unresolved external symbol __fltused

.debugflexd efsys.exe : fatal error LNK1120: 22 unresolved externals

First thing I did at that point was to create a new FORTRAN project and try replacing the .f90 main program with my source. I tried putting in my custom build rules, but they don't seem to execute. I then backed off to my original project (C++ instead of FORTRAN). and I am back to not being able to link. I have not found any documentation that tells me which libraries I need to list in the linker settings. I have looked at both for_igs.pdf and for_lib.pdf to no avail.
My project is Multi-threaded and I am trying to link statically with MFC and ATL. I need to build both DEBUG and RELEASE versions. My IFORT command is

"C:Program FilesIntelFortrancompiler80IA32BINifort" /nologo /Zi /Od /GB /f77rtl /warn:ignore_loc /warn:truncated_source /assume:dummy_aliases /Qfpstkchk /iface:cref /module:"$(INTDIR)/" /object:"./" /traceback /libs:static /dbglibs /libdir:noauto /c "%what%.%ext%"

0 Kudos
4 Replies
Steven_L_Intel1
Employee
507 Views
Remove "/libdir:noauto". In the project property pages, this is Fortran..Libraries..Disable default library search rules - change to "No".

This setting, which is "Yes" by default in static library projects, tells the compiler to not include in the object file directives to pull in the run-time libraries. This is correct when the library is used by another Fortran project, but not when the main program is not Fortran.
0 Kudos
jbalster
Novice
507 Views
Thank you Steve, That did the trick. It's so very nice to have you're expertise available.
0 Kudos
joe-griffin
Beginner
507 Views
I am getting a similar error:

MSC.Fatigue E:\mscfat\build\windows\mapdef>"C:Program Files (x86)/Intel/ComposerXE-2011/bin/ia32/ifort" mapdef.for libifcore.lib /LIBPATH:"c:\Program Files (x86)\Intel

\ComposerXE-2011\compiler\lib\ia32" libifcore.lib

Intel Visual Fortran Compiler XE for applications running on IA-32, Version 12.0.4.196 Build 20110427

Copyright (C) 1985-2011 Intel Corporation. All rights reserved.

ifort: command line warning #10006: ignoring unknown option '/LIBPATH:c:\Program Files (x86)\Intel\ComposerXE-2011\compiler\lib\ia32'

Microsoft Incremental Linker Version 10.00.30319.01

Copyright (C) Microsoft Corporation. All rights reserved.

-out:mapdef.exe

-subsystem:console

mapdef.obj

libifcore.lib

libifcore.lib

mapdef.obj : error LNK2019: unresolved external symbol ___intel_new_proc_init referenced in function _MAIN__

mapdef.obj : error LNK2019: unresolved external symbol _for_set_reentrancy referenced in function _MAIN__

mapdef.obj : error LNK2019: unresolved external symbol _for_cpystr referenced in function _MAIN__

mapdef.obj : error LNK2019: unresolved external symbol _for_getarg referenced in function _MAIN__

mapdef.obj : error LNK2019: unresolved external symbol _for_open referenced in function _MAIN__

mapdef.obj : error LNK2019: unresolved external symbol _DELFILESQQ referenced in function _MAIN__

mapdef.obj : error LNK2019: unresolved external symbol _for_write_seq_fmt referenced in function _MAIN__

mapdef.obj : error LNK2019: unresolved external symbol _for_read_seq_fmt referenced in function _MAIN__

mapdef.obj : error LNK2019: unresolved external symbol _for_cpstr referenced in function _MAIN__

mapdef.obj : error LNK2019: unresolved external symbol _for_f90_index referenced in function _MAIN__

mapdef.obj : error LNK2019: unresolved external symbol _for_close referenced in function _MAIN__

mapdef.obj : error LNK2019: unresolved external symbol _for_write_seq_lis referenced in function _MAIN__

LIBCMT.lib(crt0.obj) : error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup

mapdef.exe : fatal error LNK1120: 13 unresolved externals



I looked at for_cpystr and found it:

:\Program Files (x86)\Intel\ComposerXE-2011\compiler\lib\ia32>dumpbin /symbols libifcore.lib | grep for_cpystr

03 00000000 SECT1 notype () External | _for_cpystr

So I tried LIBPATH, but I still get unresolves. Do you have any ideas?

0 Kudos
mecej4
Honored Contributor III
507 Views
/LIBPATH:... is a linker option, so you should provide a /link compiler option to tell it that what follow are linker options.
0 Kudos
Reply