| | |
Error when calling a method of dynamic array
Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved |
Hi, I'm getting this error:
Asig 2.cpp In function `void ManiMatrix()': 31
Asig 2.cpp expected primary-expression before "int"
Asig 2\Makefile.win [Build Error] ["Asig 2.o"] Error 1
Here is how I'm calling it from main: customMatrix.checkIfMagic();
Prototype in the class: void checkIfMagic(int**);
void matrix::checkIfMagic(int **arrayOfArray)
{// function began
} // function end
Any suggestion will be appreciated.
Asig 2.cpp In function `void ManiMatrix()': 31
Asig 2.cpp expected primary-expression before "int"
Asig 2\Makefile.win [Build Error] ["Asig 2.o"] Error 1
Here is how I'm calling it from main: customMatrix.checkIfMagic();
Prototype in the class: void checkIfMagic(int**);
void matrix::checkIfMagic(int **arrayOfArray)
{// function began
} // function end
Any suggestion will be appreciated.
Last edited by kako13; Feb 8th, 2008 at 9:41 pm.
•
•
•
•
I don't see anything wrong withcheckIfMagic. But what is this functionvoid ManiMatrix()in the first warning? Also make sure thatManiis not a misspelling forMain.
customMatrix.checkIfMagic() from a function include in the main. I also calls another function from there without any problem. I use Void ManiMatrix to call the functions that are in the class. So what you're saying is that you have a function called
Please use code tags when you post code!
ManiMatrix which is supposed to call customMatrix.checkIfMagic() ? In that case, could you post the the line in which you call checkIfMagic() in a little bit of context? The compiler error mentions 'int', which I haven't seen yet.Please use code tags when you post code!
Last edited by John A; Feb 8th, 2008 at 10:54 pm.
"Technological progress is like an axe in the hands of a pathological criminal."
All my posts may be freely redistributed under the terms of the MIT license.
All my posts may be freely redistributed under the terms of the MIT license.
•
•
•
•
So what you're saying is that you have a function calledManiMatrixwhich is supposed to callcustomMatrix.checkIfMagic()? In that case, could you post the the line in which you call checkIfMagic() in a little bit of context? The compiler error mentions 'int', which I haven't seen yet.
Please use code tags when you post code!
C++ Syntax (Toggle Plain Text)
void ManiMatrix () { // ManiMatrix began matrix customMatrix; customMatrix.createFile(); customMatrix.readFileIntoArray(); customMatrix.checkIfMagic(); } // ManiMatrix end
Updated error:
Asig 2\Asig 2.cpp In function `void ManiMatrix()': Asig 2\Asig 2.cpp no matching function for call to `matrix::checkIfMagic()' Asig 2\matrix.h:118 candidates are: void matrix::checkIfMagic(int**) Asig 2\Makefile.win [Build Error] ["Asig 2.o"] Error 1
Well I want to pass an array that is inside the class, how I do that?
I try this but I got error:
I try this but I got error:
{ // ManiMatrix began
matrix customMatrix;
customMatrix.createFile();
customMatrix.readFileIntoArray();
customMatrix.checkIfMagic(arrayOfArray);
} // ManiMatrix endI:\Class\CCOM 4005\Asig\Asig 2\Asig 2.cpp In function `void ManiMatrix()': 31 I:\Class\CCOM 4005\Asig\Asig 2\Asig 2.cpp `arrayOfArray' undeclared (first use this function) (Each undeclared identifier is reported only once for each function it appears in.) I:\Class\CCOM 4005\Asig\Asig 2\Makefile.win [Build Error] ["Asig 2.o"] Error 1
Last edited by kako13; Feb 9th, 2008 at 6:27 pm.
>Well I want to pass an array that is inside the class, how I do that?
I'm assuming you mean that the array is a member of
I'm assuming you mean that the array is a member of
matrix . In that case, you'd call the function like this: C++ Syntax (Toggle Plain Text)
customMatrix.checkIfMagic( customMatrix.arrayOfArray );
Last edited by John A; Feb 9th, 2008 at 7:06 pm.
"Technological progress is like an axe in the hands of a pathological criminal."
All my posts may be freely redistributed under the terms of the MIT license.
All my posts may be freely redistributed under the terms of the MIT license.
•
•
•
•
>Well I want to pass an array that is inside the class, how I do that?
I'm assuming you mean that the array is a member ofmatrix. In that case, you'd call the function like this:
C++ Syntax (Toggle Plain Text)
customMatrix.checkIfMagic( customMatrix.arrayOfArray );
matrix , so is not in public or private area... •
•
•
•
arrayOfArray is a dynamic array create inside a method of the class matrix , so is not in public or private area... arrayOfArray as a public/private member of matrix , or you need a pointer to it that is accessible within the scope of ManiMatrix(). "Technological progress is like an axe in the hands of a pathological criminal."
All my posts may be freely redistributed under the terms of the MIT license.
All my posts may be freely redistributed under the terms of the MIT license.
![]() |
Similar Threads
- Tutorial: Understanding ASP classes (ASP)
- Safe Array (C++)
Other Threads in the C++ Forum
- Previous Thread: Dynamic 2 dimensional array
- Next Thread: eval function
| Thread Tools | Search this Thread |
Tag cloud for C++
6 add api array arrays beginner binary bmp c++ c/c++ calculator char class classes code compile compiler console conversion convert count data delete desktop directshow dll download dynamic encryption error file forms fstream function functions game givemetehcodez google graph gui iamthwee ifstream input int java lib library lines linkedlist linker loop looping loops map math matrix memory microsoft newbie news number output pointer problem program programming project python random read recursion recursive reference return sort string strings struct studio system temperature template templates test text text-file tree unix url variable vector video visual visualstudio void win32 windows winsock wordfrequency wxwidgets






