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

"Error LNK2019: unresolved external symbol" Problem

Selimhocaoglu__Tugca
1,077 Views

Hi there,

I am a Ph.D student and trying to incorporate an already available Newton-Raphson solver into my code. When I try to run the solver with its subroutines and functions included in the main program file, there is no problem. However, when I separate the subroutines and functions into a module, I receive a LNK2019 + LNK1120 error. I attached the separated files. I'm stumped and have no idea how to solve this. I very much appreciate your help.

I am running Visual Studio 2017 + XE2018 Update 4 on a Win 10 computer.

Thank you very much in advance.

0 Kudos
1 Reply
mecej4
Honored Contributor III
1,077 Views

Module procedure (i.e., subroutine and function) bodies should end with "END SUBROUTINE" or "END FUNCTION", as appropriate, rather than just "END".

Since FMIN is a module function, its type is known throughout the module. Any re-declaration of the type of FMIN (such as REAL or EXTERNAL) is going to supersede that type and create a reference to an external name, and at link time that external procedure will be missing. Simply remove all the superfluous type declarations.

0 Kudos
Reply