On Sat, May 31, 2003 at 09:27:50PM +0530, Neeraj  Garg, Noida wrote:
> Hello everybody,
> 
> I am trying to port an application on linux. In the building process, i want
> to use two step process:
> 
> g++ -nostdinc -MD  -O2 -funroll-loops -fforce-addr -Wall -W -Wpointer-arith
> -Wno-unused  -I/usr/lib/gcc-lib/i386-redhat-linux/2.96/include
> -I/usr/include -W -Wmissing-prototypes  -D__GCC32__  -c <src_file> -o
> <object_file>
> 
> and then ld -L/usr/lib/gcc-lib/i386-redhat-linux/2.96/ -L/usr/lib -lpthread
> -lstdc++ -lg++ -lgcc -lm -lc <all .o files> -o <a.out>

The "common wisdom" is to use gcc for the link phase too. It is more
likely to know how to link all the right pieces together.

> ------------------------------
> To remove the warning "ld: warning: cannot find entry symbol _start;
> defaulting to 08048f58", i am adding following in ld command line:
> /usr/lib/crt1.o /usr/lib/crti.o
> /usr/lib/gcc-lib/i386-redhat-linux/2.96/crtbegin.o
> /usr/lib/gcc-lib/i386-redhat-linux/2.96/crtend.o /usr/lib/crtn.o
> ---------------------------
> 
> Now a.out is successfully built. But now if am trying to execute it, it
> gives me following error:
> "bash: ../a.out: No such file or directory"
> 
> ------------------------------------
> 
> Can anybody please tell me if i am supposed to include other linux standard
> libraries to execute an a.out problem which is built using g++ and ld?
> 
> -neeraj
> 
> 
> 
> ----------------------------------------------------------------------
> Neeraj Kumar Garg            
> Member Technical Staff
> 
> HCL Technologies Ltd.
> A-5, Sector 24                Work: 91-11-91-2411502 Ext 2560
> Noida UP - 201301             Fax:  91-11-91-2440155
> India
> ----------------------------------------------------------------------
> 
> 
> 
> -- 
> redhat-list mailing list
> unsubscribe mailto:[EMAIL PROTECTED]
> https://www.redhat.com/mailman/listinfo/redhat-list

-- 
---- Fred Smith -- [EMAIL PROTECTED] ------------------------ ----
                    Do you not know? Have you not heard? 
    The LORD is the everlasting God, the Creator of the ends of the earth. 
  He will not grow tired or weary, and his understanding no one can fathom.
----------------------------- Isaiah 40:28 (niv) -----------------------------


-- 
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]
https://www.redhat.com/mailman/listinfo/redhat-list

Reply via email to