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

LNK2019 error in using intel fortran 11.1 with visual studio 2008 ok when I use bat file

Oivind_Moen
Beginner
964 Views
Hello
I have a program system with a library. I can build the system OK using the following bat file
using the intel fortran 11.1

echo off

echo Building ospe3.exe

time /T

ifort ..\\AP.f ..\\model.f ..\\dbint.for ..\\Onspotsim.for ..\\..\\..\\LS\\lib1.lib ..\\kinetics.f /nologo /Zi /Od /I./GPR /I../../os /I../ap /I../mo /module:"./" /object:"./" /traceback /check:bounds /threads /dbglibs /exe:ospe3

So this works fine.


However when I try to link the object files with the visual studio 2008 I get a number of lnk2019 errors

as seen below. First the link line from the buildlog and then the errors.


Linking...

Link /OUT:"Debug/OS PE3.exe" /INCREMENTAL:NO /NOLOGO /NODEFAULTLIB:"..\\..\\ls\\lib1.lib" /MANIFEST:NO /DEBUG /PDB:"Debug/OS PE3.pdb" /IGNOREIDL /IMPLIB:"\\\\GS0255\\USERS$\\ROMOENOI\\borouge\\Borouge 2\\OS PE\\OS PE3\\Debug\\OS PE3.lib" /qnoipo kernel32.lib /MACHINE:I386 "Debug/model.obj" "Debug/dbint.obj" "Debug/kinetics.obj" "Debug/OnspotSim.obj" "Debug/AP.obj"




OnspotSim.obj : error LNK2019: unresolved external symbol _LSOPTN@8 referenced in function _OS_STARTUP

OnspotSim.obj : error LNK2019: unresolved external symbol _LSSOL@88 referenced in function _OS_NLPSOLVER

OnspotSim.obj : error LNK2019: unresolved external symbol _DNRM2@12 referenced in function _OS_NLPSOLVER

Debug/OS PE3.exe : fatal error LNK1120: 3 unresolved externals

OS PE3 - 4 error(s), 0 warning(s)



What do I do wrong?






0 Kudos
6 Replies
Steven_L_Intel1
Employee
964 Views
The routines OS_STARTUP, etc., are making reference to STDCALL versions of the three mathematics routines, hence the @n suffixes. I recognize DNRM2 but not the other two - none of these are provided by Intel Fortran.

You will need to find out where these routines are supposed to be defined, and how they are called. If STDCALL is the correct convention, then perhaps all you need to do is add the library defining these routines to your link line.
0 Kudos
bmchenry
New Contributor II
964 Views
one other possibility...since it compiled fine in bat, then the routines are available, however, i'm wondering if it might be related to a gen-interfaces default in the 2008 environment which during link produces an 'error' which isn't caught when done in batch w/o gen-interfaces??
check your defaults for the build environment.
do a search on gen-interfaces in these message for threads on that topic.
brian

0 Kudos
Oivind_Moen
Beginner
964 Views
Thanks for the reply. I have compiled and made the library with the intel compiler 11.1 for the LSSOL rutines and used this library both via the bat file as well as via the VS2008 interface. So I think it might have to do with the interface. Can you please give some more details how I should search in the default for the build environment - the gen-interfaces. Thanks in advance.
Best wishes
ivind
0 Kudos
Steven_L_Intel1
Employee
964 Views
In Visual Studio, right click on the project and select Properties. Go to Fortran > External Procedures. Change Calling Convention to "Default". Repeat this for any other projects in the solution, then rebuild.

This is not a "generated interfaces" issue.
0 Kudos
mecej4
Honored Contributor III
964 Views
I noticed this odd fact: in the batch build, ..\..\ls\lib1.lib is included in the link step. However, during the VS build, the link step shows /NODEFAULTLIB:"..\..\ls\lib1.lib". It may be that this is a VS linker option which should be removed or deactivated.
0 Kudos
Oivind_Moen
Beginner
964 Views
Thanks for your help all of you. I changed some of the calls and subroutine names to uppercase and hey presto it worked!
Thanks again
Best wishes
ivind
0 Kudos
Reply