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

Link Not Searching Lib

Brooks_Van_Horn
New Contributor I
612 Views

My build looks like:

G:\Desktop\Pearson>build

G:\Desktop\Pearson>rem Build script for Pearson
G:\Desktop\Pearson>deftofd resource.h resource.fd
G:\Desktop\Pearson>rc Pearson.rc
Microsoft (R) Windows (R) Resource Compiler Version 6.3.9600.17298
Copyright (C) Microsoft Corporation.  All rights reserved.

G:\Desktop\Pearson>call cf pearsonglobals
G:\Desktop\Pearson>iFort /nologo -Od /traceback /c pearsonglobals.f90
G:\Desktop\Pearson>lib /nologo MyLib.lib pearsonglobals.obj
Replacing pearsonglobals.obj

G:\Desktop\Pearson>ifort /nologo /WinApp Pearson.f90 MyLib.Lib Pearson.res
MyLib.Lib(purge.obj) : error LNK2019: unresolved external symbol RANFGET referenced in function PURGE
MyLib.Lib(purge.obj) : error LNK2019: unresolved external symbol RANFPUT referenced in function PURGE
Pearson.exe : fatal error LNK1120: 2 unresolved externals

I don't know why the link step does not pick up MyLib.lib which is local to all the source codes. Below, I've had lib list all of its entries. The ranf.obj has 3 routines in it and it is encompassed by a module I call Random. The invoking routine, Purge, has a use statement invoking random. What am I doing wrong?

Thanks,
Brooks V

 

G:\Desktop\Pearson>lib /list mylib.lib
Microsoft (R) Library Manager Version 12.00.31101.0
Copyright (C) Microsoft Corporation.  All rights reserved.

pearsonglobals.obj
purge.obj
TypeVII.obj
TypeV.obj
TypeIII.obj
TypeI.obj
LnGamma.obj
GetK.obj
Howe.obj
Van.obj
dographs.obj
dohisto.obj
getrs.obj
Horn.obj
zData.obj
Integrate.obj
TypeII.obj
TypeIV.obj
TypeVI.obj
TypeVIII.obj
ranf.obj

0 Kudos
1 Solution
JVanB
Valued Contributor II
612 Views

The problem isn't in your link step, it's at compilation time. If PURGE could see the declarations for RANFGET and RANFPUT in module RANDOM, their names would be decorated with the module name, unless there is a name= or ALIAS clause in their declarations. What happens if you put

USE RANDOM, ONLY: RANFGET, RANFPUT

among the USE statements of function PURGE? Does it compile without error?

 

View solution in original post

0 Kudos
3 Replies
JVanB
Valued Contributor II
613 Views

The problem isn't in your link step, it's at compilation time. If PURGE could see the declarations for RANFGET and RANFPUT in module RANDOM, their names would be decorated with the module name, unless there is a name= or ALIAS clause in their declarations. What happens if you put

USE RANDOM, ONLY: RANFGET, RANFPUT

among the USE statements of function PURGE? Does it compile without error?

 

0 Kudos
Brooks_Van_Horn
New Contributor I
612 Views

No it doesn't

 

G:\Desktop\Pearson>cf purge

G:\Desktop\Pearson>iFort /nologo -Od /traceback /c purge.f90
purge.f90(8): error #5082: Syntax error, found IDENTIFIER 'RANFGET' when expecting one of: => ( :
Use Random, ONLY RANFGET, RANFPUT
-----------------^
compilation aborted for purge.f90 (code 1)

0 Kudos
Brooks_Van_Horn
New Contributor I
612 Views

But I hadn't put a USE RANDOM in Purge and doinf so fixed the problem.

Thanks much,

Brooks V

0 Kudos
Reply