www.digitalmars.com         C & C++   DMDScript  

c++ - Simple help with classes

reply A. J. <A._member pathlink.com> writes:
I new to programming and c++ (I started this semester at school).  At school I
learned how to use c++ on unix machines.  I want to try writing some code on my
windows machine, but I cannot figure something out.  The problem is with
creating and including classes.  
I wrote a class "Deck" that has a deck.h and deck.cpp file.  I tested the class
with a very small driver program written on the cpp file and it worked fine.
The problem I have is when I made another file decktest.cpp and I want to
include deck.h with it.  I remember in unix i would first make my header files
into *.o files, then include them as arguments when I compiled my program.
The way I am used to doing it is like this:

prompt->  g++ -c deck.cpp
prompt->  g++ -o decktest decktest.cpp deck.o

where decktest is the outputted binary.  I am not sure how to make *.o files and
am not sure if that is even what Windows needs.  And, once I have *.o files (if
they are necessary) how do I compile everything into a *.exe?  I am using
TextPad to write my code and digital mars's newest version of its compiler.  Any
help would be appreciated.  If you would like to look at any of my code to tell
me what to add please email me and I will gladly send it.

A. J.
zyberwoo uga.edu
Dec 19 2004
parent "Walter" <newshound digitalmars.com> writes:
"A. J." <A._member pathlink.com> wrote in message
news:cq4dih$14md$1 digitaldaemon.com...
 The way I am used to doing it is like this:

 prompt->  g++ -c deck.cpp
 prompt->  g++ -o decktest decktest.cpp deck.o

 where decktest is the outputted binary.  I am not sure how to make *.o

 am not sure if that is even what Windows needs.  And, once I have *.o

 they are necessary) how do I compile everything into a *.exe?  I am using
 TextPad to write my code and digital mars's newest version of its

The equivalent to the above would be: dmc -c deck dmc decktest deck.obj Object files are *.obj on Windows instead of *.o.
Dec 19 2004