home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / lang / cplus / 19028 < prev    next >
Encoding:
Text File  |  1993-01-12  |  1.1 KB  |  37 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!sdd.hp.com!ux1.cso.uiuc.edu!cs.uiuc.edu!sparc0b!pjl
  3. From: pjl@cs.uiuc.edu (Paul Lucas)
  4. Subject: Re: c++.newbie has problem with mult. #includes
  5. Message-ID: <C0r7yp.A5r@cs.uiuc.edu>
  6. Sender: news@cs.uiuc.edu
  7. Organization: University of Illinois at Urbana-Champaign
  8. References: <93Jan12.172129.20662@acs.ucalgary.ca>
  9. Date: Tue, 12 Jan 1993 18:42:25 GMT
  10. Lines: 25
  11.  
  12. In <93Jan12.172129.20662@acs.ucalgary.ca> jabraham@acs.ucalgary.ca (John Abraham) writes:
  13.  
  14. >I have two classes, meplannode and emme2node.  Each of them is
  15. >derived from the base class node.
  16.  
  17. >I want to use both of them in a file scope, so I #include "meplan.h" and
  18. >"emme2.h".  Problem - both of them #include "node.h", so I get
  19. >multiple definition errors for the node class.  What do I do?
  20.  
  21. >It seems pretty kludgy to put:
  22. >#ifndef _classname
  23. >...
  24. >...
  25. >...
  26. >#define _classname
  27. >#endif
  28. >around every single .h file.
  29.  
  30. >Is this a common problem?  Am I missing something obvious?
  31.  
  32.     No; that's the way everybody does it.
  33. -- 
  34.     - Paul J. Lucas
  35.       AT&T Bell Laboratories
  36.       Naperville, IL
  37.