tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
From: Charles Vachon <cvachon2 () mrn ! gouv ! qc ! ca>
To: tru64-unix-managers
Subject: basic ld linker question
Date: Thu, 07 Sep 2000 19:09:40 +0000	[thread overview]
Message-ID: <96835371209106.tru64-unix-managers.marc@archive.invalid> (raw)

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

                 reply	other threads:[~2000-09-07 19:09 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
read-only archive

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