πŸš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #942

Classes in multiple files

#942
From: Thomas Lionel SMETS
Date: Mon, 03 Jan 2000 00:00
93 lines
3249 bytes
This is a multi-part message in MIME format.
--------------9527A9939FDDAD84DA5F4502
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit




Well the question should have a rather straight answer but I do know how

to do it, so ...

I wish to have two classes in two separated files, as such :


============== B E G I N    O F   F I L E  1   ====================
#include ...   // Only standart header files <iostream>, etc ...
class ClassName1 {
    // Implementation




}
============== E N D   O F    F I L E  1 =======================

============== B E G I N    O F   F I L E  2   ====================
#include ...   // Only standart header files <iostream>, etc ...
class ClassName2 : class ClassName1 {
    // Implementation




}

int main() {
    // Implementation of pgrm
}
============== E N D   O F    F I L E  2 =======================

Now the question is :
    How do I compile this properly ?

Currently my make file is, as such :

============= Begin of Make File ===================
ClassName1 : ClassName1.cpp
    g++ ClassName1.cpp -o ClassName1

ClassName2 : ClassName2.cpp ClassName1.o
    g++ ClassName2.cpp ClassName1.o  -o ClassName2

ClassName1.o : ClassName1.cpp
    g++ -c ClassName1.cpp
============= End of Make File ===================

As I don't know how to make Header files for other thiings than C
function --> there is no Header file comin' from my code. Secondly ... I

don't link the ".o" files ... Maybe it's a mistake ?

A kind answer would be appreciated   :-)  !

Thanks in advance,

Thomas,

--
mail : thomas.smets@gonthier-be.com (professionnel)
       tsmets@altern.org (privοΏ½)



--------------9527A9939FDDAD84DA5F4502
Content-Type: text/x-vcard; charset=us-ascii; name="vcard.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Thomas, Lionel SMETS
Content-Disposition: attachment; filename="vcard.vcf"

begin:          vcard
fn:             Thomas, Lionel SMETS
n:              SMETS;Thomas, Lionel
org:            Etablissements GONTHIER s.a.
email;internet: tsmets@altern.org
title:          Responsable de l'informatique
x-mozilla-cpt:  ;0
x-mozilla-html: FALSE
version:        2.1
end:            vcard


--------------9527A9939FDDAD84DA5F4502--
Technical Details
Message-ID: <38712C84.AFD15365@altern.org>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: 11318c,e4d48c4967f0bc5,start
X-Google-Attributes: gid11318c,public
X-Google-Thread: 100a19,e4d48c4967f0bc5,start
X-Google-Attributes: gid100a19,public
X-Google-Thread: faa64,e4d48c4967f0bc5,start
X-Google-Attributes: gidfaa64,public
X-Google-Thread: 10ba33,e4d48c4967f0bc5,start
X-Google-Attributes: gid10ba33,public
From: Thomas Lionel SMETS <tsmets@altern.org>
Subject: Classes in multiple files
Date: 2000/01/03
Message-ID: <38712C84.AFD15365@altern.org>
X-Deja-AN: 567934339
Content-Type: multipart/mixed; boundary="------------9527A9939FDDAD84DA5F4502"
X-Complaints-To: abuse@tvd.be
X-Trace: news.chello.be 946941598 195.162.211.60 (Tue, 04 Jan 2000 00:19:58 MET)
Organization: Chello Usenet Service
MIME-Version: 1.0
NNTP-Posting-Date: Tue, 04 Jan 2000 00:19:58 MET
Newsgroups: gnu.gcc.help,gnu.g++.help,alt.os.linux,be.comp.os.linux