This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Classes in multiple files
- To: help-gcc at gnu dot org
- Subject: Classes in multiple files
- From: Thomas Lionel SMETS <tsmets at altern dot org>
- Date: Mon, 03 Jan 2000 23:19:58 GMT
- Newsgroups: gnu.gcc.help,gnu.g++.help,alt.os.linux,be.comp.os.linux
- Organization: Chello Usenet Service
- Xref: wodc7nx0 gnu.gcc.help:2343 gnu.g++.help:1290 alt.os.linux:32564 be.comp.os.linux:5927
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é)
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