From: Francis Glassborow on
Pat wrote:
> Francis Glassborow wrote:
>> Pat wrote:
>>> I wanted to text the use of complex numbers in C++, so I set up the
>>> following (very simple) program:
>>>
>>> **************************************
>>> #include <iostream>
>>> #include <complex.h>
>>
>> standard headers do not have .h
>>>
>>> using namespace std;
>>>
>>> int main()
>>> {
>>> complex z;
>>> z = complex(1,2);
>>> cout << "z=" ,z,<< endl;
>> look at the above line which I am pretty sure was the one flagged by
>> your compiler. What are those commas doing?
>
>
> Opps! Those commas are a typo. They shouldn't be there.
>
> With regard to header, the example I was basing this on actually had the
> ".h". But even with that removed, and with everything past the "complex
> z;" commented out, I'm still getting these errors. So the error is
> specially related to the "complex z;" declaration. Any other ideas?
>
> Thanks,
>
> Pat

Penny has dropped. complex is a template with three specialisations
complex<float>, complex<double> and complex<long double>. A class
template is like half a type and you need to supply the details to
complete it because the compiler cannot read your mind.