Here's an update on the situation.

I thought that maybe initializing the temp with a different method would fix the problem, so I put instead of HardwareRecord temp; HardwareRecord temp(0,"","",0);, and this also did not compile.

This means my compiler is screwing up my constructors, and I do not know what is wrong.

Here is my code right now:

//  HardwareRecord.h
//  Initialize Hardware Store File
//  Created by --------- on 5/18/14.
//  Copyright (c) 2014 --------. All rights reserved.
//  Definition of HardwareRecord class

#ifndef __Initialize_Hardware_Store_File__HardwareRecord__
#define __Initialize_Hardware_Store_File__HardwareRecord__

#include <iostream>

class HardwareRecord


    HardwareRecord(const unsigned& account=0,const std::string& name="",const std::string& description="",const double& price=0);
    HardwareRecord operator=(const HardwareRecord&);

    //'set' and 'get' functions
    void setAccountNumber(unsigned);
    unsigned getAccountNumber() const;

    void setName(std::string);
    std::string getName() const;

    void setPrice(double);
    double getPrice() const;

    void setDescription(std::string);
    std::string getDescription() const;

    void wipeRecord(); //set everything to blank

    unsigned myAccountNumber;
    std::string myName;
    std::string myDescription;
    double myPrice;

#endif /* defined(__Initialize_Hardware_Store_File__HardwareRecord__) */

My .cpp file for the class definition:

//  HardwareRecord.cpp
//  Initialize Hardware Store File
//  Created by --------------- on 5/18/14.
//  Copyright (c) 2014 ---------. All rights reserved.
//  Implementation of HardwareRecord class definition

#include <iostream>
#include <stdexcept> //std::invalid_argument
#include "HardwareRecord.h"

using namespace std;
using std::string;
using std::invalid_argument;
HardwareRecord HardwareRecord::operator=(const HardwareRecord & aRecord)

    return *this; //allow for cascaded overloading

HardwareRecord::HardwareRecord(const unsigned& account,const string& name,const string& description,const double& price):myAccountNumber(account),myName(name),myDescription(description),myPrice(price)

void HardwareRecord::wipeRecord()

void HardwareRecord::setAccountNumber(unsigned num)

unsigned HardwareRecord::getAccountNumber() const
    return myAccountNumber;

void HardwareRecord::setName(string name)



string HardwareRecord::getName() const
    return myName;

void HardwareRecord::setPrice(double price)
    if (price < 0)
        throw invalid_argument("\nThe price can not be less than zero");

double HardwareRecord::getPrice() const
    return myPrice;

void HardwareRecord::setDescription(string description)

string HardwareRecord::getDescription() const
    return myDescription;

And finally, my main.cpp file, where I still get the error:

    //  main.cpp
    //  HardwareStoreApplication
    //  Created by ---------------- on 6/17/14.
    //  Copyright (c) 2014 ------- --------. All rights reserved.
    //  Application that models a store's record of inventory

    #include <iostream>
    #include <fstream>
    #include <iomanip>
    #include <cstdlib>
    #include <sstream>
    #include "HardwareRecord.h" //HardwareRecord definition
    using namespace std;

    //enumeration of choices
    const string SELECT[]= {"Wipe Records","Update Records","List Records","Print Records","Delete Records","Add New Record","End Program"};

    std::ostream& operator<<(std::ostream& op,const Choices& choice)
        //print the string corresponding to the value of enum type Choices
            op << SELECT[choice]; //print output
        return op;

    //prototype of helper functions
    unsigned enterChoice();
    void wipeRecords(/*fstream&*/); //can do later
    void updateRecord(fstream&);
    void listRecords(fstream&);
    void createTextFile(fstream&);
    void deleteRecord(fstream&);
    void newRecord(fstream&);

    int main()
        //open file for reading and writinbg
        fstream outRecord ("HardwareRecord.dat",ios::in|ios::out|ios::binary);

    //exit program if fstream cannot open file
    if (outRecord)

        int choice; //user's choice

        do //enable user to specify action
            //ONLY valid choices get returned

            cout << "\nYour choice was to " << SELECT[choice] << " ... \n";

            switch (choice)
                case WIPE_RECORDS: //wipe all records clean

                case UPDATE: //update a record

                case LIST: //list all current records

                case PRINT: //print a record

                case DELETE: //delete a record

                case NEW: //add a new record (if space allows)

                case END:
                    cout << "\nPress 'Enter' to continue/exit... " << flush;

        } while (choice != END);

    else //exit program if fstream cannot open file
        cerr << "\nFile could not be opened." << endl;

        return 0;

    //enable user to input menu choice from menu options
    //now ... loops until there is a valid input. //
    unsigned enterChoice()
        unsigned menuChoice;

    //loop until have a vailid input
    for (;;) //example of a C/C++ 'forever' loop ... //
        menuChoice = LAST;

        //display avaliable options
        cout << "\nEnter your choice: \n" << endl;
        for (unsigned i=WIPE_RECORDS; i < LAST; i++)
            cout << i << " - " << SELECT[i] << endl;

        cout << "\nEnter your choice > ";

        //'CRASH PROOF' & make sure only valid numbers accepted //
        if (cin >> menuChoice && cin.get() == '\n')
            if (menuChoice < LAST)
                break; //break out of loop RIGHT NOW...//

        //else ... when reach here ...
        cin.clear(); //clear any cin error flags ...
        cin.sync();  //'flush' cin
        cout << "\nOnly integers in range 0..." << LAST-1 << " are valid here.\n";
        cout << "Please try again... \n";

        return menuChoice;

    //Can do this later ... //
    void wipeRecords(fstream& theFile)
        HardwareRecord temp(0,"","",0);
        for (int i=0; i < 100;i++)
            //convert record from binary and assign to temp
            //make temp "wipe itself"
            /*theFile.seekg(i*sizeof(HardwareRecord)); //move to position


As you can see, I tried to initialize temp with the default values for the only constructor that is defined in the class, and the I got same error that I got for the line HardwareRecord temp;.

Something is going wrong. I believe that this may be a compiler issue, since I defined everything properly.

Please respond ASAP about this.

Out of curiosity what happens if you define your constructor in the class in the header file instead of the .cpp file?

I found out what the problem was. It was not with the compiler, as I may have previously thought.

As you may know about random access file programs, a separate program is required to make a .dat file, so I had two projects for it: one to create the .dat file with special specifications, and another one to actually act as the application.

I created the HardwareRecord.h and the HardwareRecord.cpp file, and I added them to both projects as they were needed.
However, when I was working on the HardwareRecord application project (after I finished the project that initializes the file), I felt that certain changes were neccessary, and thus, I altered the classes' contents. This resulted in two versions of the HardwareRecord class which were conflicting with each other- hence the error message raised when it had one definition of initializer and expected another initializer.

I would like to express my sincere thanks to those that have tried to help me out, Moschops, NathanOliver and DavidW. While You may not have been able to help me out completely, you helped me clean up my code in ways that I would not have even imagined.

I wish you all the best, and for those that are looking at this thread- please learn from my lesson. It will serve you well.

I would also like to apoligize for asking people spending their precious time on my problem, and for any inconvenience I may have created.