Hey,
I have a struct .h file, another h file and a .cpp file with my main method. I am trying to make a list using the data type I created in my struct file, but it is not recognizing -> and keeps throwing error:
OrthogonalLinkedSparseMatrix.h:46: error: base operand of ‘->’ has non-pointer type ‘OrthogonalNode’
where OrthogonalLinkedSparseMatrix.h is my implementation header file and OrthogonalNode is my struct class.
//CONSTRUCTOR
OrthogonalLinkedSparseMatrix(int r, int c, int v)
{
rows= r;
cols= c;
TotValues= v;
}
OrthogonalLinkedSparseMatrix() {};
//Insert values into Matrix
/*void insert(int r, int c, int v)
{
OrthogonalNode newnode;
newnode->row = r;
newnode->col = c;
newnode->value = v;
newnode->right = NULL;
newnode->down= NULL;
}
*/
void createList(int r, int c, int v)
{
if(rowList->down == NULL)
{
}
}
OrthogonalNode rowList;
OrthogonalNode colList;
//void transpose(OrthogonalLinkedSparseMatrix &b);
//void add(OrthogonalLinkedSparseMatrix &b, OrthogonalLinkedSparseMatrix &c);
private:
int rows; // number of rows in matrix
int cols; // number of columns in matrix
int TotValues;
and the struct program has
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
#ifndef OrthogonalNode_
#define OrthogonalNode_
//#include "OrthHeaderNode.h"
//no template class. Can only use integers
struct OrthogonalNode
{
// data members
int value;
int row;
int col;
OrthogonalNode *right;
OrthogonalNode *down;
};
#endif