Well, I'm just getting back into C++ and having the exact same problems, even using the fix I posted earlier:
This is cut and pasted from the book "Professional C++"
// SpreadsheetCell.h
class SpreadsheetCell
{
public:
void setValue(double inValue);
double getValue() const;
protected:
double mValue;
};
// SpreadsheetCell.cpp
#include "SpreadsheetCell.h"
void SpreadsheetCell::setValue(double inValue)
{
mValue = inValue;
}
double SpreadsheetCell::getValue() const
{
return mValue;
}
#include "SpreadsheetCell.h"
#include <iostream>
using namespace std;
int main()
{
SpreadsheetCell cell1;
cell1.setValue(5.3);
cout << cell1.getValue() << endl;
return 0;
}
When I compile, I get the following errors:
||=== Build: Debug in SpreadsheetCellNumOnly (compiler: GNU GCC Compiler) ===|
/home/xxxx/Documents/Code Blocks Prj/SpreadsheetCellNumOnly/src/SpreadsheetCell.cpp|4|error: no ‘void SpreadsheetCell::setValue(double)’ member function declared in class ‘SpreadsheetCell’|
/home/xxxx/Documents/Code Blocks Prj/SpreadsheetCellNumOnly/src/SpreadsheetCell.cpp|9|error: no ‘double SpreadsheetCell::getValue() const’ member function declared in class ‘SpreadsheetCell’|
||=== Build failed: 2 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|
Once again, it appears that Codeblocks isn't including Spreadsheet.h while compiling, even though I manually went in (as I posted previously) included the "include" directory in the project search path. In fact, when I type in the code, Codeblocks correctly pops up the Spreadsheet class methods correctly?
Anyone have with an idea as to what's going on?
Thanks.