Qt - Problems while serializing "double"
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?
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?
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!
精彩评论