I'm building a simple application to solve sudoku puzzles. It's my first time creating something serious with C++, so I'm open for code style/structure critique.
The problem I bumped into has something to do with organizing multiple files.
I have two classes referencing each other using functions. When I try to call a function:
void Field::runColumnCheckout(CellGroup* sender, int cellRelativeX)
{
}
in a CellGroup
class using an instance of Field
class:
void CellGroup::runISC(int possibilityNumber)
{
for (int x = 0; x < 3; x++) {
int amountInColumn = 0;
for (int y = 0; y < 3; y++)
if (cells[x][y]->isPossible(possibilityNumber))
amountInColumn++;
if (amountInColumn > 1) {
//parentField is an instance of a Field class
//stored in a private field of the CellGroup class
parentField->runColumnCheckout(this, x);
return;
}
}
//...
}
An undefined reference occures. I don't quite understand, why.
All the examples were taken from cell_group.cpp
and field.cpp
that are defining classes from cell_group.h
and field.h
.
Unfortunately, I couldn't manage to put all the files in a question as they have gained a lot of lines, but you can look at them on my github.
I have found a similar question and another one, but they seem to have issue with the way they compile their files. I've had two referencing each other classes structured similarly before adding code I have problem with right now and everything compiled fine.
I'm compiling everything using GCC compiler on Windows and CodeBlocks as an IDE.