delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/12/10/17:01:16

Date: Wed, 10 Dec 1997 16:57:22 -0500
From: Joe Davidson <dream_acres AT compuserve DOT com>
Subject: Header files under djgpp?
Sender: Joe Davidson <dream_acres AT compuserve DOT com>
To: "djgpp AT delorie DOT com" <djgpp AT delorie DOT com>
Message-ID: <199712101658_MC2-2B80-6094@compuserve.com>
MIME-Version: 1.0

A few days ago, I posted a message concerning header files and the response
I got said to take out all the code out of the header file, so I did that,
but I still get the same message, "multiple defintion of <function name>". 
I tried writing a small program, and I sill got the same problem.  Here is
the source code:

box.h-

#ifndef box_h
#define box_h                                 // Chapter 5 - Program 7

class box {
   int length;
   int width;
public:
   void set(int new_length, int new_width);
};

#endif

-------------------
box.cc-

#include "box.h"

#pragma implementation


// This method will set a box size to the two input parameters
void box::set(int new_length, int new_width)    //the compiler complains
about this line.
{
   length = new_length;
   width = new_width;
}


In the main file, all I do is a #include "box.h"


Respond to me through mail at <dream_acres AT compuserve DOT com> because I don't
subscribe to the mailing list.  

Thank You

Joe Davidson

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019