Thursday, February 7, 2008

C++ errors

g++ -c -o Symmetric.o Symmetric.cpp
Symmetric.cpp:30: error: declaration of ‘virtual int Symmetric::position(int, int)’ outside of class is not definition
Symmetric.cpp:31: error: expected unqualified-id before ‘{’ token
make: *** [Symmetric.o] Error 1

This is pretty obvious to most people, but if you happen to run into this error, try taking a look at the definition of the function, it may be as simple as a out of place semicolon. In this case, the problem was in this line of Symmetric.cpp.

I just placed a semicolon on the definition of that class function.

int Symmetric::position(int i,int j);
{
...
};

This was one heck of a project this file came from. It was an exercise in inheritance. I'll post some more info on it later, as I think it was a very informative programming assignment.

No comments: