cout<<complex_num gives seg fault w/ intel compiler

B

bluekite2000

I have

#include<iostream>
#include<complex>
typedef std::complex<float> ComplexSingle;
int main(void)
{
ComplexSingle a(2,3);
std::cout<<a.real()<<std::endl;//this works
std::cout<<a.imag()<<std::endl;//this works
std::cout<<a;//this works w/ g++, not icc.


return 1;
}

I think this problem is compiler specific but if u guys can help,
please do. I have searched all over the net to no avail.
thanx
 
B

benben

I have

#include<iostream>
#include<complex>
typedef std::complex<float> ComplexSingle;
int main(void)
{
ComplexSingle a(2,3);
std::cout<<a.real()<<std::endl;//this works
std::cout<<a.imag()<<std::endl;//this works
std::cout<<a;//this works w/ g++, not icc.


return 1;
}

I think this problem is compiler specific but if u guys can help,
please do. I have searched all over the net to no avail.
thanx

I compiled it with both g++ and MSVC 7.1 and it worked fine.

Regards,
Ben
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,434
Messages
2,571,689
Members
48,796
Latest member
Greg L.

Latest Threads

Top