Thread: need help with error message

  1. #1
    Registered User
    Join Date
    Oct 2001
    Posts
    23

    need help with error message

    I don't understand why I keep getting this error message. Here's my program & error message:

    Script started on Sun Dec 02 11:41:53 2001
    strauss.udel.edu% cat mailinglabel.h

    //Programmer: Christine

    //Date:

    //Section:

    //header file for mailinglabel class



    #ifndef MailingLabel_H

    #define MailingLabel_H



    #include <iostream>

    using std :: ostream;



    class MailingLabel {

    public:

    MailingLabel(); //default constructor

    MailingLabel(char*, char*, int); //class constructor

    //MailingLabel(MailingLabel&); //copy constructor

    //~MailingLabel(); //class destructor

    MailingLabel& operator=(const MailingLabel&); //overloaded

    //assignment operator

    void output(ostream&) const; //print out to a file

    //void input(istream&); //get input from a file

    private:

    char *name;

    char *address;

    int zipcode;

    };

    #endif

    strauss.udel.edu% cat mailinglabel.cc

    //member functions for mailinglabel class

    //class implementation part I of lab



    #include "mailinglabel.h"

    #include <iostream>

    using std :: endl;

    using std :: ostream;



    MailingLabel :: MailingLabel () {

    name = NULL;

    address = NULL;

    zipcode = 0;

    }

    MailingLabel :: MailingLabel(char *n, char *a, int z) {

    name = new char[strlen(n) + 1];

    strcpy(name, n);



    address = new char[strlen(a) + 1];

    strcpy(address, a);



    zipcode = z;

    }

    void MailingLabel :: output(ostream &output) const{

    output << name << endl;

    output << address << endl;

    output << zipcode << endl;

    }

    strauss.udel.edu% CC mailinglabel.cc mailinglabel.h

    ld: elf error: file mailinglabel.h: unknown type, unable to process using elf(3E) libraries

    ld: fatal: File processing errors. No output written to a.out

    strauss.udel.edu% exit

    strauss.udel.edu%
    script done on Sun Dec 02 11:42:24 2001

  2. #2
    Registered User programmer's Avatar
    Join Date
    Oct 2001
    Posts
    22

    Talking

    Well #ifndef MailingLabel_H

    #define MailingLabel_H

    should come after you include the <iostream> header file ... i.e
    #include <iostream>
    using std :: ostream;

    #ifndef MailingLabel_H
    #define MailingLabel_H

Popular pages Recent additions subscribe to a feed