How to Track Undefined Symbols during Linking
(Doc ID 40721.1)
Last updated on MARCH 26, 2019
Applies to:Precompilers - Version 126.96.36.199 and later
Information in this document applies to any platform.
***Checked for relevance on 26-Mar-2019***
A common error on UNIX machines when attempting to link a program is as follows:
>cc -I. -O -xcg92 -L/usr3/V716/lib -o sample1 sample1.o
Undefined first referenced
symbol in file
ld: fatal: Symbol referencing errors. No output written to sample1
This error occurs when the linker (invoked by cc in this case) cannot find symbols referenced in the source code. A symbol is a programme object for example a function. This problem is occurring because externally declared symbols cannot be located in the directories specified in the link command with the '-L' option.
In general terms the remedy for this type of problem is to locate the library that contains the relevant symbol(s) and ensure that the linker is looking in the right places.
The easiest way to identify which libraries to use is to look at the output from making one of the sample programs and adjusting your link line accordingly.
Versions after 7.3 have make files in 2 parts to allow you to include the definitions of the Oracle Libraries easily see <Note:41478.1> New Makefile Structures with Unix on 7.3
To view full details, sign in with your My Oracle Support account.
Don't have a My Oracle Support account? Click to get started!