Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs have moved to the Altera Community. Existing Intel Community members can sign in with their current credentials.
29317 Discussions

Fortran Error LNK2019 - Unresolved External Symbol D_ZANLY referenced in function MAIN_

Wayne_Y
Novice
5,111 Views

I have some issues using the IMSL ZANLY function with Fortran and Visual Studios 2019. I am trying to follow this example (https://help.imsl.com/fortran/6.0/math/default.htm?turl=zanly.htm) with my code below for your reference, and was given the following error LNK2019.

I have added the library directories for the IMSL functions in the project properties (following https://help.imsl.com/fortran/2021.0/common/readme.html#link-options under "USING FNL WITH VISUAL STUDIOS 2017". I also tried changing my LINKER > SYSTEM > SUBSYSTEM from console to windows but that doesn't work and generated an additional error saying " error LNK2019: unresolved external symbol WinMain referenced in function "int__cdeclinvoke_main(void)"(?invoke_main@@YAHXZ) ". Does any one have any suggestions to resolve this please?

program Console

USE ZANLY_INT
USE WRCRN_INT
implicit none

INTEGER    :: INFO(3), NGUESS, NNEW
COMPLEX*16 :: F, Z(3), ZINIT(3)
EXTERNAL      F    
DATA ZINIT/3*(1.0,1.0)/

NNEW   = 3
NGUESS = 3

CALL D_ZANLY (F, Z, NNEW=NNEW, NGUESS=NGUESS,ZINIT=ZINIT, INFO=INFO)
!CALL D_WRCRN ('The zeros are', Z)

end program Console

COMPLEX*16 FUNCTION F (Z)
COMPLEX*16 :: Z
F = Z**3 + 5.0*Z**2 + 9.0*Z + 45.0

RETURN
END

 

Labels (2)
0 Kudos
1 Solution
mecej4
Honored Contributor III
5,085 Views

You need to specify that the IMSL libraries are to be used at link time. I tried your example code with old versions of IMSL FNL (version 7) and IFort (2013 SP1), and the example built and worked fine. The build command that I used was

 

 

ifort /Qimsl xzanly.f90

 

 

If you are building in Visual Studio, see the documentation that came with your versions of IMSL, Intel Fortran and Visual Studio.

View solution in original post

0 Kudos
2 Replies
mecej4
Honored Contributor III
5,086 Views

You need to specify that the IMSL libraries are to be used at link time. I tried your example code with old versions of IMSL FNL (version 7) and IFort (2013 SP1), and the example built and worked fine. The build command that I used was

 

 

ifort /Qimsl xzanly.f90

 

 

If you are building in Visual Studio, see the documentation that came with your versions of IMSL, Intel Fortran and Visual Studio.

0 Kudos
Wayne_Y
Novice
5,049 Views

Thanks for the reply. You're right - on second look, I have missed out the following line in the code: include "link_fnl_shared_imsl.h". This has resolved the problem.

0 Kudos
Reply