Simpler Navigation for Servers and Operating Systems
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
cancel
Showing results for 
Search instead for 
Did you mean: 

Compiling with CC

Highlighted
Donald Skidmore
Occasional Contributor

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.

Thanks
3 REPLIES
Georg Tresselt
Honored Contributor

Re: Compiling with CC

Could you post the entire error message? That might give us a hint here.
http://www.tresselt.eu
Masatake Hanayama
Trusted Contributor

Re: Compiling with CC

Probably missing crt0.o. For example,

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

(succeed)
$ 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/dld.sl 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.
Dennis Handly
Acclaimed Contributor

Re: Compiling with CC

>Probably missing crt0.o.

 

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