tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
* basic ld linker question
@ 2000-09-07 19:09 Charles Vachon
  0 siblings, 0 replies; only message in thread
From: Charles Vachon @ 2000-09-07 19:09 UTC (permalink / raw)
  To: tru64-unix-managers

Hello Tru64 admins,

Trying to compile a C program on Tru64 4.0F.
Let's say I have a .c program like this:

/*
* A very basic C program: basic.c
*/

#include <stdio.h>
int main( int argc, char *argv[] )
{
int i;

printf( "program  %s has %d arguments:\n", argv[0],argc-1 );

for ( i=3D1; i < argc; i++ )
  printf( "argv %d: %s\n", i, argv[i] );

return(0);
}
/*
* end of basic C program
*/

I can successfully compile and link with "cc -o basic basic.c".

What stumps me is when I create an object file with "cc -c basic.c",
which produces a basic.o file, and then I try to link using "ld
-call_shared -o basic -lc basic.o", I do get a "Unresolved: printf" from
ld. Further, if I chmod u+x the resulting (executable) object file named
basic and I try to execute it, I do get messages like the following

10893:./basic: /sbin/loader: Error: Unresolved symbol in
/usr/shlib/libc.so: __ldr_data
10893:./basic: /sbin/loader: Error: Unresolved symbol in
/usr/shlib/libc.so: __Argc
10893:./basic: /sbin/loader: Error: Unresolved symbol in
/usr/shlib/libc.so: __Argv
10893:./basic: /sbin/loader: Fatal Error: this executable has
unresolvable symbols

Can anyone shed light on this?

I know this is certainly a very basic issue, but I'm not all too
familiar with the numerous options to ld and cc commands.

Thanks in advance.

--

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Charles Vachon tel: (418) 627-6355 x2760
  email: cvachon2@mrn.gouv.qc.ca
  Administrateur de syst=E8me
  FRCQ/Minist=E8re des Ressources
  Naturelles du Qu=E9bec
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2000-09-07 19:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2000-09-07 19:09 basic ld linker question Charles Vachon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox