Author Topic: multifile headache  (Read 1194 times)

smokey

  • Member
  • **
  • Posts: 183
  • Kudos: 0
multifile headache
« on: 7 September 2002, 20:48 »
I am writing an app in c++ and I have a class which I need to be able to access in two cpp files but I dont know how to do this. How would I go about to get two cpp files to use this one class? Thanks in advance  
//this is how I was born :)

cat /dev/urandom > /dev/mybrain

Tip for win98 (l)users: type copy /con/con in your command prompt to increase stability


choasforages

  • VIP
  • Member
  • ***
  • Posts: 1,729
  • Kudos: 7
    • http://it died
multifile headache
« Reply #1 on: 7 September 2002, 21:01 »
err, im probably wrong, but try making something like

blah.h

and sticking the class in the header

and having

#include "./blah.h"
/*not sure about how to do it, haveint played with c++ in months*/
x86: a hack on a hack of a hackway
alpha, hewlett packed it A-way
ppc: the fruity way
mips: the graphical way
sparc: the sunny way
4:20.....forget the DMCA for a while!!!

smokey

  • Member
  • **
  • Posts: 183
  • Kudos: 0
multifile headache
« Reply #2 on: 7 September 2002, 21:03 »
it worked  
thanks again
//this is how I was born :)

cat /dev/urandom > /dev/mybrain

Tip for win98 (l)users: type copy /con/con in your command prompt to increase stability


badkarma

  • VIP
  • Member
  • ***
  • Posts: 497
  • Kudos: 0
multifile headache
« Reply #3 on: 11 September 2002, 17:17 »
a small note about the #include directive:

#include <filename> will include the given file name from the global includepath first and #include "filename" will include the given file name from the current path first. So the ./ is not neccesary if you use quotes.
If you can't learn to do something well, learn to enjoy doing it poorly.