Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Welcome to the Intel Community. If you get an answer you like, please mark it as an Accepted Solution to help others. Thank you!
26755 Discussions

"Error LNK2019: unresolved external symbol" Problem


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
Black Belt

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.