bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Linking problem???


From: Nick Clifton
Subject: Re: Linking problem???
Date: 23 Oct 2002 16:56:00 +0100
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/21.1

Hi Gyana,

>    I have one "Hello World " object file. I want to get the executable 
> without 
> using gcc directly. Instead I want to link the object file to the library by 
> using ld in command line. 
> 
>    As per man page of ld to link an object file with C library we can use,
> ld -o I<output> /lib/crt0.o hello.o -lc
> but it is giving error 
> ld: cannot open /lib/crt0: No such file or directory as the file <crt0> does 
> not exist in specified directory.
> 
> So which file should we use instead of </lib/crt0> to link our "Hello World" 
> object file ??

Try using gcc first to compile and link the program.  Once you have
the program working you can add "-v" to the gcc command line to see
how it is invoking the linker.  You can then just copy this command
line and you will have everything necessary in order to invoke the
linker on its own.

Note - gcc will probbably run a program called "collect2" rather than
then linker.  You can probably just replace "collect2" with "ld" and
have the resulting command line work.

Cheers
        Nick





reply via email to

[Prev in Thread] Current Thread [Next in Thread]