Originally Posted by
tabstop
Just because you called it "outFile" doesn't mean it's the right type.
Wow you guys are catching my typos left and right. I have spent too many hours straight on this project! I have one last questions and I will leave you all alone if you have the patience. I have been searching around for hours for solutions to the error:
error: expected primary-expression.
In my case the line is:
Code:
makeGen2dArray(x, numRows, rowSize[]);
where x is declared as int **x;
and the header file that contains the method is
Code:
template <class T>
void makeGen2dArray(T ** &x, int numberOfRows, int rowSize[]) {
x = new T * [numberOfRows];
for (int i = 0; i < numberOfRows; i++) {
x[i] = new T [rowSize[i]];
}
}
The solutions I have found on involve people typing in types into the function rather than the passing values, constructor misuse, and wrong parameters being passed into the function. In my case, I pass in a reference to a double array known as **x which should be correct, an integer I read from a file, and an array of integers which is also correct.
The specific error says:
hw1prob1.cpp:20: error: expected primary-expression before â]â token
and line 20 is:
Code:
makeGen2dArray(x, numRows, rowSize[]);