views:

67

answers:

2

I serialize "double" data type and get an error though

 QDataStream & operator<< ( double f )

operator is defined. Here is the error message:

 error: conversion from 'double' to 'const QChar' is ambiguous

Did you meat this situation or understand why it can be like this?

+1  A: 

It sounds like it can't see the operator for double, so it's trying to implicitly create a QChar from the double to send to the stream, but QChar has multiple constructors that could possibly match.

Make sure that your header includes are all correct.

Can you show us the code where you're trying to serialize the double?

Mark B
Very logical and right! Thanks. I forgot to includ QDataStream.
Narek
A: 

You might find it useful to write any double-literals (if you're using any) with the decimal portion as well, i.e.

ds << 0.0;

Rather than

ds << 0;

It probably won't solve your problem, but it'll cut down any ambiguity!

leegent
Oh wait, I think I read your error backwards...
leegent