interstice
interstice

Reputation: 115

C++ Error Code C1004

I'm trying to write a class in C++, but whenever I try to compile, it fails with this error:

"fatal error C1004: unexpected end-of-file found"

I'm using VS2010. Microsoft's documentation(http://msdn.microsoft.com/en-us/library/4exw7xyc(v=vs.80).aspx) says that this error is caused by a missing closing brace, semicolon, etc. But I can see from code highlighting that all the braces match up, and I believe that you're notified if you're missing a semicolon.

class HashTable {
protected:
    int HighValue;
    char** AddressTable;
    int* Table;

public:
    HashTable(){
        HighValue = 0;
    }
    ~HashTable(){
        delete AddressTable;
        delete Table;
    }
    void AddPair(char* address, int value){
        AddressTable[HighValue] = address;
        Table[HighValue] = value;
        HighValue += 1;
    }
    int GetValue(char* address){
        for (int i = 0; i<HighValue; i++){
            if (AddressTable[HighValue] == address) {

                return Table[HighValue];
            }
        }
        //If the value doesn't exist throw an exception to the calling program
        throw 1;
    };

}

Upvotes: 1

Views: 337

Answers (1)

Greg Hewgill
Greg Hewgill

Reputation: 992707

Class definitions must end in a semicolon:

class HashTable {

    // ...

};

Upvotes: 2

Related Questions