> -----Original Message-----
> From: dev...@li...
> [mailto:dev...@li...] On Behalf
> Of Daniel Anderson
> Sent: Friday, April 05, 2002 3:21 AM
> To: dev...@li...
> Subject: [Dev-C++] Help me in deciphering complier error...
>
>
> Hello coders,
> I have run into a problem with a program I am writing. I
> have a parent
> class, DynArray, that StatArray is derived from.
> dynarray.cpp is in one
> file, statarray.cpp is in another. My main program has an #include
> "statarray.cpp" statement, and statarray.cpp in turn #include's
> "dynarray.cpp". When attempting to compile the program, I
> get the following
> errors. I am guessing this type of error indicates that I
> might be mixing
> types, but I can't figure out where and what I need to
> correct. Any help is
> appreciated. Thanks!
> Danny
>
> main.cpp: In function `int main()':
> main.cpp:38: conversion from `StatArray (*)()' to non-scalar type
> `StatArray' requested
> main.cpp:14: in passing argument 1 of `GetArray(StatArray &,
> ifstream &)'
> main.cpp:40: conversion from `StatArray (*)()' to non-scalar type
> `StatArray' requested
> main.cpp:15: in passing argument 1 of `PrintArray(const StatArray &,
> ofstream &)'
>
>
> /* code fragment here: */
>
> 14 void GetArray(StatArray&, ifstream&);
> 15 void PrintArray(const StatArray&, ofstream&);
> ...
> 36 StatArray myArray(); /* constructor */
>
> 38 GetArray(myArray, inData);
>
> 40 PrintArray(myArray, outData);
>
> /* func definitions empty */
> void GetArray(StatArray& targetArray, ifstream& inData)
> {}
> void PrintArray(const StatArray& sourceArray, ofstream& outData)
> { }
#include places the contents of the file in its place, and it is as if
you wrote everything in that place and not in a separate file.
From this you can understand everything i guess.
Ioannis
* Ioannis Vranos
* Programming pages: http://www.noicys.cjb.net
* Alternative URL: http://run.to/noicys
|