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

Windows 10, VS 2019 v142, LNK2001: unresolved external symbol

JerryJTJ
Beginner
746 Views

Hello,

I am currently trying to build a solution which is primarily composed of C++ code calling Fortran code.

I get the output:

1>ADSAP.obj : error LNK2001: unresolved external symbol _LMDER1@48
1>ELLIP.obj : error LNK2001: unresolved external symbol _LMDER1@48
1>ADSAP.obj : error LNK2001: unresolved external symbol _ENORM@8
1>ADSAP.obj : error LNK2001: unresolved external symbol _DPOSVM@28
1>PROFILE.obj : error LNK2001: unresolved external symbol _DVERK@40
1>PROFILE.obj : error LNK2001: unresolved external symbol _INTRP@36

I seem to, more or less, have the same issue as posted here; I've tried following the solution posted but I can't seem to get anywhere.

  • For the part where this article says to click on "Microsoft.Cpp.Win32.user" and add the includes, there seems to be no Microsoft.Cpp.Win32.user in VS2019? In any case, I just added the includes to the project property pages.

Please let me know if there's anything else I need to post (any diagnostic info, etc.)

Any help would be much appreciated! Cheers.

 

Labels (2)
0 Kudos
2 Replies
andrew_4619
Honored Contributor II
737 Views

I assume the obj files listed are from Fortran source. Where are routines LMDIR1, ENORM etc to be found? From the message the the leading _ and the @NN it would seem the .obj files are expecting to call those routines with the 32bit STDCALL protocol so those routines wherever they are need to be set up that way or the caller routines need to changed to match the protocol of those routines. You need to supply a bit more info such (for example) the source of a routine for a call and a called routine and maybe a buildlog.html showing a full build.

0 Kudos
mecej4
Honored Contributor III
713 Views

From the names of the unsatisfied external symbols, I gather that your C++ code is trying to call Minpack and Lapack routines. Are you compiling the Fortran sources of Minpack yourself, or are you using a pre-built library? Are you building 32-bit or 64-bit EXEs/DLLs? Do you use MKL for the Lapack routines, or do you have another way?

As Andrew noted, you would have needed to make a non-default setting change in order to require Fortran routines with STDCALL linkage. Does your C++ code specify STDCALL linkage, or did you use C compiler options to make that happen?

The more details that you can provide regarding your sources and build procedures, the better.

0 Kudos
Reply