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

Unresolved External Symbols problems

haizi_cqu
Beginner
870 Views
I am working on an old Fortran program which was programed about ten years ago. I use both the Fortran powerstation 4.0 compiler and the Compaq Visual Fortran compiler to compile it, and it has no errors. But when I build it, following errors occured:

Text4.obj : error LNK2001: unresolved external symbol __f_settextposition
Text4.obj : error LNK2001: unresolved external symbol __f_outtext
Text4.obj : error LNK2001: unresolved external symbol __f_moveto
Text4.obj : error LNK2001: unresolved external symbol _ALSETA@16
Text4.obj : error LNK2001: unresolved external symbol _ALRELB@8
Text4.obj : error LNK2001: unresolved external symbol _ALDB@12
Text4.obj : error LNK2001: unresolved external symbol _ALWFC@4
Text4.obj : error LNK2001: unresolved external symbol _ALSB@4
Text4.obj : error LNK2001: unresolved external symbol _ALRETB@4
Text4.obj : error LNK2001: unresolved external symbol _ALLB@4
Text4.obj : error LNK2001: unresolved external symbol _ALFDL@8
Text4.obj : error LNK2001: unresolved external symbol _ALRSET@0
Text4.obj : error LNK2001: unresolved external symbol _ALTERM@0
Text4.obj : error LNK2001: unresolved external symbol _ALINIT@0
In the program, I included four files:INCLUDE 'FGRAPH.FI',INCLUDE 'ATLDEFS.FOR', INCLUDE 'ATLERRS.FOR' andINCLUDE 'FGRAPH.FD'. Both atldefs.for and atlerrs.for define some parameters for using a data collecting board.
I looked through the program, all the symbols above were defined either using "external" or using "interface to function". ( for example:
INTERFACE TO FUNCTION getcolor()
INTEGER*2 getcolor[FAR,C,ALIAS:"__getcolor"]
END)
I really do not know what is happening and how to correct these errors now.
Any help are appreciated.
thanks.
0 Kudos
8 Replies
mecej4
Honored Contributor III
870 Views
With a few changes (USE IFQWIN in the source, /libs:qwin or libs:qwins as a compiler option) Intel Fortran will compile your program.

If you are using FPS or DVF, there should be a library called qwin.lib (or dfqwin.lib or something similar) that you need to add to the optional libraries list of your build.
0 Kudos
haizi_cqu
Beginner
870 Views
Quoting mecej4
With a few changes (USE IFQWIN in the source, /libs:qwin or libs:qwins as a compiler option) Intel Fortran will compile your program.

If you are using FPS or DVF, there should be a library called qwin.lib (or dfqwin.lib or something similar) that you need to add to the optional libraries list of your build.

I used both the Windows powerstation 4 and the CVF for compiling the program. Do you have any suggestion for this?

by the way, How to add the optional libraries list to the build? I am new to Fortran and I only know add lib directory.

For my program, when I only add one Fortran lib directory where "ATLDEFS.FOR,ATLERRS.FOR" stays, there are some errors which said I miss some Lib. So I add the compile lib to the lib directory, then unresolved external symbols errors occur. It seem that the program only use one lib directory.

any other suggestion?

thanks.
0 Kudos
mecej4
Honored Contributor III
870 Views
"I used both the Windows powerstation 4 and the CVF for compiling the program. Do you have any suggestion for this?"

Don't use two compilers in one build, unless you have a specific reason
"How to add the optional libraries list to the build? I am new to Fortran and I only know add lib directory. "

See the user guide of your compiler. If using a command line, you just add the name(s) of the additional library(ies) at the end, with the '.lib' extension explicitly included.

"For my program, when I only add one Fortran lib directory where "ATLDEFS.FOR,ATLERRS.FOR" stays, there are some errors which said I miss some Lib. So I add the compile lib to the lib directory, then unresolved external symbols errors occur. It seem that the program only use one lib directory."

I have no idea what those Fortran source files are. Their names suggest that they are users' files. Specifying a .lib directory only tells the compiler where to search. You also need to tell it which library files to search, beyond the default libraries.

"Any other suggestion?" Beginners will do well to read the documentation before attempting to run complex programs.
0 Kudos
haizi_cqu
Beginner
870 Views
"I have no idea what those Fortran source files are. Their names suggest that they are users' files. Specifying a .lib directory only tells the compilerwhereto search. You also need to tell itwhichlibrary files to search, beyond the default libraries."
Yes, I donot know how to tell the program which library files to search.
I know I should read more documentations. However, My advisor is pushing me everyday to get this program work. This program work fine several years ago. So she think that there is no problem for me to work on it.
these two files ATLDEFS.FOR,ATLERRS.FOR are from a software named ATLAB, which enable to collect data from a DT2821 A/D board.
Anyway, Thank you for your reply. Have a good day.
0 Kudos
haizi_cqu
Beginner
870 Views
! This is the ATLDEFS.for file. Ithoughtsymbols such as ALBAD, ALINIT were defined here, However, when I build the program, it said unresolved external symbol ALBAD, ALINIT....


! ATLAB entry point and data definitions for FORTRAN
!
IMPLICIT INTEGER*2 (I-N)
INTEGER*2 ALBAD, ALBDA, ALESC, ALCAD, ALCDA, ALDSC
EXTERNAL ALBAD, ALBDA, ALESC, ALCAD, ALCDA, ALDSC
INTEGER*2 ALINIT, ALTERM, ALRSET
EXTERNAL ALINIT, ALTERM, ALRSET
INTEGER*2 ALADS, ALAV, ALCB, ALDAS, ALDOT, ALDV, ALEFO
EXTERNAL ALADS, ALAV, ALCB, ALDAS, ALDOT, ALDV, ALEFO
INTEGER*2 ALFDL, ALFOPN, ALFREW, ALGC, ALIDV, ALLB, ALRAL
EXTERNAL ALFDL, ALFOPN, ALFREW, ALGC, ALIDV, ALLB, ALRAL
INTEGER*2 ALRC, ALRETB, ALSB, ALSECW, ALSETD, ALSP, ALSTOP
EXTERNAL ALRC, ALRETB, ALSB, ALSECW, ALSETD, ALSP, ALSTOP
INTEGER*2 ALWFC, ALAOT, ALAXMB, ALDB, ALUDB, ALEFI
EXTERNAL ALWFC, ALAOT, ALAXMB, ALDB, ALUDB, ALEFI
INTEGER*2 ALFCLO, ALFLSH, ALFRD, ALFWRT, ALODV, ALRB, ALRELB
EXTERNAL ALFCLO, ALFLSH, ALFRD, ALFWRT, ALODV, ALRB, ALRELB
INTEGER*2 ALSC, ALSETA, ALSF, ALST, ALTB, ALUB
EXTERNAL ALSC, ALSETA, ALSF, ALST, ALTB, ALUB
! file header data structure offset definitions
PARAMETER ( KFHLEN = 416 )
PARAMETER ( KDEVID = 3 )
PARAMETER ( KDEVFLAGS = 4 )
PARAMETER ( KSCNCNT = 5 )
PARAMETER ( KCHANLST = 6 )
PARAMETER ( KGAINLST = 22 )
PARAMETER ( KCHANCOM = 38 )
PARAMETER ( KACQDATE = 358 )
PARAMETER ( KACQTIME = 363 )
PARAMETER ( KTIME = 369 )
PARAMETER ( KCLKPER = 370 )
PARAMETER ( KSAMCNT = 372 )
PARAMETER ( KRDCNT = 374 )
PARAMETER ( KACQCOM = 376 )
! unit configuration array offset definitions
PARAMETER ( KCONFIG = 16 )
PARAMETER ( KCBASEADR = 1 )
PARAMETER ( KCDEVID = 2 )
PARAMETER ( KCDEVFLAGS = 3 )
PARAMETER ( KCSCAN = 4 )
PARAMETER ( KCCHANNELS = 5 )
!
! bit field definitions for data structures
!
! DMA mode mask and options
!
PARAMETER (IDMAMODE = 2#0000011)
PARAMETER (IPROGRAMMEDIO = 2#0000000)
PARAMETER (ISINGLECHANNEL = 2#0000001)
PARAMETER (IDUALCHANNEL = 2#0000010)
PARAMETER (ISEDI = 2#0000100)
PARAMETER (IUNIPOLAR = 2#0001000)
! data encoding mask and options
PARAMETER (IENCODING = 2#0110000)
PARAMETER (IOFFSETBINARY = 2#0000000)
PARAMETER (ISTRAIGHTBINARY = 2#0010000)
PARAMETER (ITWOSCOMPLEMENT = 2#0100000)
PARAMETER (ISIGNEXTENDED = 2#1000000)
! bit definitions for the A/D timing source
PARAMETER (INTCLOCK = 2#000)
PARAMETER (IEXTCLOCK = 2#001)
PARAMETER (INTTRIGGER = 2#000)
PARAMETER (IEXTTRIGGER = 2#010)
PARAMETER (ITRIGSCAN = 2#100)
! direction indicators for ATLAB file opens
PARAMETER (IALWRITE = 1)
PARAMETER (IALREAD = 0)
! device identifiers
PARAMETER (IUNUSED = 16#0000)
PARAMETER (K28 = 16#0001)
PARAMETER (K27 = 16#0002)
PARAMETER (K21FDI = 16#0004)
PARAMETER (K21FSE = 16#0008)
PARAMETER (K21 = 16#0010)
PARAMETER (K21GDI = 16#0020)
PARAMETER (K21GSE = 16#0040)
PARAMETER (K23 = 16#0080)
PARAMETER (K25 = 16#0100)
PARAMETER (K24PGH = 16#0200)
PARAMETER (K24PGL = 16#0400)
PARAMETER (K29 = 16#0800)
PARAMETER (KOTHER = 16#8000)
! end of ATLAB definitions for FORTRAN

0 Kudos
haizi_cqu
Beginner
870 Views
! This is the atlerrs.for. I include this file at the beginning of the main program
! ATLERRS.FOR - ATLAB error definitions for FORTRAN
!
PARAMETER ( KBUFFER = 10 )
! buffer over/underrun during I/O
PARAMETER ( KDAERR = 9 )
! D/A error detected
PARAMETER ( KADERR = 8 )
! A/D error detected
PARAMETER ( KOUTTMO = 7 )
! user timeout exceeded on output
PARAMETER ( KINPTMO = 6 )
! user timeout exceeded on input
PARAMETER ( KNORMAL = 0 )
! success!
PARAMETER ( KNOATL = -1 )
! device driver ATL not found
PARAMETER ( KMANYFIL = -2 )
! too many files open
PARAMETER ( KDMAASN = -7 )
! DMA channel not assigned to unit
PARAMETER ( KGAIN = -10 )
! illegal gain specification
PARAMETER ( KDMABND = -13 )
! DMA buffer crosses 64K boundary
PARAMETER ( KNVALUE = -16 )
! non-positive number of values argument
PARAMETER ( KTIMING = -19 )
! illegal timing source value
PARAMETER ( KHIFREQ = -22 )
! requested frequency too high
PARAMETER ( KLOFREQ = -23 )
! requested frequency too low
PARAMETER ( KSMALLP = -24 )
! requested period too small
PARAMETER ( KLARGEP = -25 )
! requested period too large
PARAMETER ( KPORT = -27 )
! illegal digital port
PARAMETER ( KCHANNL = -29 )
! illegal channel number
PARAMETER ( KBOARD = -31 )
! illegal board number
PARAMETER ( KNOBCB = -50 )
! no Buffer Control Blocks available
PARAMETER ( KNOXMS = -51 )
! no extended memory buffer available
PARAMETER ( KODDALIGN = -52 )
! buffer aligned on an odd-byte boundary
PARAMETER ( KNOTBUFF = -53 )
! invalid buffer number
PARAMETER ( KBADLEN = -54 )
! illegal buffer length
PARAMETER ( KCPYBUF = -55 )
! illegal transfer count during copy buffer
PARAMETER ( KIOINPROG = -56 )
! I/O in progress using buffers
PARAMETER ( KLINKED = -57 )
! buffer already linked
PARAMETER ( KNOUNDCL = -58 )
! buffer is linked to Buffer Transfer List
PARAMETER ( KRELEASED = -59 )
! buffer already released to user
PARAMETER ( KNOTLINK = -60 )
! buffer not linked to Buffer Transfer List
PARAMETER ( KRETURNED = -61 )
! buffer already returned
PARAMETER ( KNOFILE = -62 )
! no file by that name exists
PARAMETER ( KNOOPEN = -63 )
! can't open the requested file
PARAMETER ( KFREAD = -64 )
! error reading data file
PARAMETER ( KFWRITE = -65 )
! error writing data file
PARAMETER ( KNOTDAT = -66 )
! not an ATLAB data file
PARAMETER ( KEOF = -67 )
! end of file encountered on data file
PARAMETER ( KNOTINPROG = -68 )
! I/O not in progress
PARAMETER ( KBADBTL = -69 )
! illegal Buffer Transfer List
PARAMETER ( KNODASUPP = -70 )
! no D/A conversion on this board
PARAMETER ( KSCANLIST = -71 )
! board cannot perform single channel A/D
PARAMETER ( KUNEXP = -100 )
! unexpected error
! end ATLERRS.FOR
0 Kudos
mecej4
Honored Contributor III
870 Views
Presumably, the two files that you posted are INCLUDEd in your program TEXT4.FOR, since the files ATLERRS.FOR and ATLDEFS.FOR contain only variable type declarations. I would also guess that TEXT4.FOR contains calls to subroutines and references to functions such as ALBAD.

You need a library that contains the object code for these subroutines and functions (or source code), possibly with a name similar to ATLAB.LIB.

Do you have such a library? If not, and if you do not have the source code for functions such as ALBAD, you are stuck.

You also need the Quickwin library. You have to link TEXT4.OBJ to both ATLAB.LIB and QWIN.LIB.
0 Kudos
haizi_cqu
Beginner
870 Views
Quoting mecej4
Presumably, the two files that you posted are INCLUDEd in your program TEXT4.FOR, since the files ATLERRS.FOR and ATLDEFS.FOR contain only variable type declarations. I would also guess that TEXT4.FOR contains calls to subroutines and references to functions such as ALBAD.

You need a library (or source code) that contains the object code for these subroutines and functions, possibly with a name similar to ATLAB.LIB.

Do you have such a library? If not, and if you do not have the source code for functions such as ALBAD, you are stuck.

You also need the Quickwin library. You have to link TEXT4.OBJ to both ATLAB.LIB and QWIN.LIB.

Yes, Thank you for your explanation. Your explanations are so clear.
Thanks again. I will check later.
0 Kudos
Reply