www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/02/02/16:05:23

Message-ID: <36B732D8.FBDA4D6E@sprynet.com>
Date: Tue, 02 Feb 1999 09:16:08 -0800
From: Ishpeck <atedjamulia AT sprynet DOT com>
Organization: Lunaticnologies
X-Mailer: Mozilla 4.04 [en] (Win95; U)
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
To: djgpp AT delorie DOT com
Subject: Re: djgpp
References: <19990126143913 DOT 27518 DOT qmail AT hotmail DOT com>
Reply-To: djgpp AT delorie DOT com

gcc -x c++ -o a.o -c a.cc
gcc -x c++ -o b.o -c b.cc
gcc -o name.exe a.o b.o

The first to command compile the sources to object code.
The third links the objects into the executable named "name.exe"
Tada!  You might also add (in the compiling not the linking) the
"-i" tag that tells GCC where the additional header files to include
are.

Ralf Neumann wrote:
> 
>  Hi!
>  I am trying to figure out how to compile and link several objects
> together.
>   Say we have an object A (class A ...) and an object B. Obj. A is a
> part of B (class B .... private: A a;...). A main program is trying to
> use obj. B (main .... B b;).
>   How do I compile and link those objects? I guess that first I have to
> compile each separate: gcc -c a.cc -o a.o and gcc -c b.cc -o b.o
>   But how do I go on, and if I have to use something like ld -o main.exe
> a.o b.o in the end,  how do I include iostream (here I guess  -lgpp
> doesn´t work).
>   Thank you very much indeed for your help!
> 
> Ralf
> 
> ______________________________________________________
> Get Your Private, Free Email at http://www.hotmail.com

-- 
-------------------
See Ishpeck's Programming page!
Example source, Utils, links, 
and help on your programs.
http://members.xoom.com/ishpeck/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019