Thread: need help with error message

  1. #1
    Registered User
    Join Date
    Oct 2001

    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 cat mailinglabel.h

    //Programmer: Christine



    //header file for mailinglabel class

    #ifndef MailingLabel_H

    #define MailingLabel_H

    #include <iostream>

    using std :: ostream;

    class MailingLabel {


    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


    char *name;

    char *address;

    int zipcode;


    #endif cat

    //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;

    } 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 exit
    script done on Sun Dec 02 11:42:24 2001

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


    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