Re: Compiling with CC (214 Views)
Occasional Contributor
Posts: 2
Registered: ‎12-10-2004
Message 1 of 4 (216 Views)

Compiling with CC

I am trying to compile on a HP-UX 10.20 with the CC compiler. I successfully compiled my program but failed with the link step. The error I got was unfound symbol $global(data) what is that? How do I get it resolved.

Honored Contributor
Posts: 2,668
Registered: ‎05-13-2002
Message 2 of 4 (216 Views)

Re: Compiling with CC

Could you post the entire error message? That might give us a hint here.
Trusted Contributor
Posts: 72
Registered: ‎12-23-1996
Message 3 of 4 (216 Views)

Re: Compiling with CC

Probably missing crt0.o. For example,

$ ld myobj.o -lc
ld: Unsatisfied symbols:
$global$ (data)

$ ld myobj.o /opt/langtools/lib/crt0.o -lc

ld man page explains:

Code and data from shared libraries is never copied into an executable
program. The dynamic loader /usr/lib/ is invoked at startup
time by the startup file crt0.o if a program uses shared libraries.
Identical copies of crt0.o can be found in either /usr/ccs/lib/crt0.o
or /opt/langtools/lib/crt0.o.
Acclaimed Contributor
Posts: 26,192
Registered: ‎03-06-2006
Message 4 of 4 (214 Views)

Re: Compiling with CC

>Probably missing crt0.o.


That's correct.  That's why you should always link with the compiler driver.

The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.