[Interest] Using QT and boost unit test: problem with QString

Heidler, Kirstin (GE Oil & Gas) Kirstin.Heidler at ge.com
Fri Sep 21 12:09:42 CEST 2012


Thanks,

I just thought it was more complicated than that.
I just defined the operator at the top of my testfile and it seems to be working. :)

Kirstin

-----Ursprüngliche Nachricht-----
Von: Konstantin Tokarev [mailto:annulen at yandex.ru] 
Gesendet: Freitag, 21. September 2012 12:04
An: Heidler, Kirstin (GE Oil & Gas); interest at qt-project.org
Betreff: Re: [Interest] Using QT and boost unit test: problem with QString


21.09.2012, 14:01, "Heidler, Kirstin (GE Oil & Gas)" <Kirstin.Heidler at ge.com>:
> I have to use boost unit test (not my choice). QT unit tests were working fine.
>
> I have the problem, that somewhere boost wants to append a const QString to an ostream.(I do not exactly know where this call occurs, since it is hidden in macros, but I know it is for writing a log file)
>
> So I get the compile error C2697:  binary operator '<<': no operator found which takes a right-hand operand of type ‘const QString’ (or there is no acceptable conversion).
>
> I don’t want to change boost source files. Is there another way to resolve this error?

The beautiful thing about operator overloading is that you don't have to modify library sources. You just define your own operator<< in your code, and that's all.

-- 
Regards,
Konstantin


More information about the Interest mailing list