PDA

View Full Version : qHash(double) problem with Qt 4.6 (tp1)



sascha
13th October 2009, 20:17
Hi,

I am trying to build QWT 5.2 against Qt 4.6 (tp1) with mingw. The compiler complains about ambiguous overloaded qHash, first instatiated in qwt_valuelist.h:48. Event after I change the #ifdef in ine 39 to include a check for QT_VERSION >= 0x040600, the error remains.

Has anybody experienced the same or knows of a solution?

Thanks,
Sascha

sascha
14th October 2009, 10:52
I investigated the problem further and it seems to be specific to the combination of MinGW, Qt 4.6 and qwt.

Trying to compile qwt with a native gcc against Qt 4.6 works, as well as compiling qwt with MinGW against Qt 4.5.x.

Any input is highly appreciated.

Uwe
15th October 2009, 07:03
Please check Qt 4.6 Beta first. If the problem is still there please try to write a small demo using a QList<double>, that shows the problem without Qwt.

Uwe

sascha
15th October 2009, 08:49
Ah, I see that the beta is out since yesterday! I will try it out and post the results.

Thanks,
Sascha

sascha
22nd October 2009, 14:08
Hi, I compiled the beta now with MinGW (gcc 4.4) and using a QList<double> inside a Qt project without qwt is no problem.

Somehow the compiler gets confused at qwt_valuelist.h:48, where a QList<double> is explicitly instantiated for exporting it in the qwt.dll . Uncommenting this line, results in a successful build of qwt with gcc 4.4 and Qt 4.6 beta1.

Any ideas whats happening there?

Sascha

Uwe
23rd October 2009, 09:02
Can you compile Qwt 5.2 with Qt 4.5.x and MinGW (gcc 4.4) or is it a problem of the compiler version ?

Uwe

sascha
23rd October 2009, 22:11
I did that on Linux, cross-compiling with MinGW (gcc 4.4) for Windows and it worked, but I will try it on Windows natively in the next days.

Sascha

Kazakus
23rd November 2009, 06:42
Had anybody managed with this? I've looked at qhash.h, and it's rewritten since qt 4.5, and I didn't managed to modify qwt so that it compiles for me :(

Indalo
23rd November 2009, 07:21
Follow to qwt_valuelist.h and change this:


#if QT_VERSION < 0x040300
// Some compilers have problems,
// without a qHash(double) implementation
#include <qset.h>
#include <qvector.h>
inline uint qHash(double key) { return uint(key); }
#endif

to:


#if QT_VERSION == 0x040600
// Some compilers have problems,
// without a qHash(double) implementation
#include <qset.h>
#include <qvector.h>
inline uint qHash(double key) { return uint(key); }
#endif

sascha
23rd November 2009, 18:49
Hi,

the hint posted by Indalo does not work for me.

I am using Qt 4.6 RC now and qwt still doesn't compile without modification. However, changing qwt_valuelist.h:37 from


#if defined(QWT_TEMPLATEDLL)

to


#if defined(QWT_TEMPLATEDLL) && QT_VERSION < 0x040600

works for me.

hassenman
9th December 2009, 17:41
Hi ,

i tried all the tricks mentioned above, none worked !
Any solution ?

Regards,

Uwe
9th December 2009, 18:41
Simply remove the offending line in qwt_valuelist.h

Uwe

hassenman
10th December 2009, 08:40
Thanks Uwe,

I tried to comment out the line, still getting the same compilation error

C:/qwt-5.1.2/../../Qt/2009.05/qt/include/QtCore/../../src/corelib/tools/qhash.h:875: error: call of overloaded 'qHash(const double&)' is ambiguous



#if defined(QWT_TEMPLATEDLL)

#if QT_VERSION < 0x040300
// Some compilers have problems,
// without a qHash(double) implementation
#include <qset.h>
#include <qvector.h>
inline uint qHash(double key) { return uint(key); }
#endif

// MOC_SKIP_BEGIN
template class QWT_EXPORT QList<double>;
// MOC_SKIP_END

#endif // QWT_TEMPLATEDLL

How can i check if QT_VERSION is taking the correct value ?

Is there any other workaround for this issue

Regards,

Uwe
10th December 2009, 11:14
I tried to comment out the line, still getting the same compilation error...
Then try harder: a compiler can't fail at a line, that has been removed.

More explicite: the offending line is the line exporting the template, but you can remove the complete QWT_TEMPLATEDLL scope ( or use qwt_valuelist.h from SVN 5.2 branch. )

Uwe

Jore
18th February 2010, 12:09
Im' having the same problem but in another file qhash.h. Can someone summon up, simple english, how to work around ambiguous qhash call?

c:/tools/Qt/2010.01/qt/include/QtCore/../../src/corelib/tools/qhash.h:875: error: call of overloaded 'qHash(const double&)' is ambiguous

Getting the same problem both on commandline and QT Creator
QT 4.6.1 2010.01
QWT 5.2.0
g++ 4.4.0 (gcc)

brg
Jore

Uwe
20th February 2010, 12:44
svn co https://qwt.svn.sourceforge.net/svnroot/qwt/branches/qwt-5.2

OverTheOCean
2nd March 2010, 07:22
SOLUTION

comment line 48 in the qwt_valuelish.h"
//template class QWT_EXPORT QList<double>;

no need to export this symbol !~!

Michael

Jore
2nd March 2010, 08:26
Failed Plugin
QWT_designer_plugin5.dll uses incompatible QT library. Expected build key "Windows msvc release full", got "Windows mingw release full"
(yes, I'm a newbie)

Both the project where I want to use qwt and qwt is compiled for Release. QT is configured for mingw, I do not want to use microsoft visual studio.

What am I doing wrong?
(Why is QT expecting msvc when I run it as mingw, do I have to recompile entire QT?)

kyamon
2nd March 2010, 13:25
Hi

I am having exactly the same problem.
Using QT4.6.2 and mingw on win7 (the OS may be risky, but considering the fact that many XP-users have the same problem, I don't think that this is an issue).
Compiling qwt-5.2 works fine, but then the plugin does not seem to install correctly in QTDesigner. That is - it works in the "standalone" version of designer but not inside QTCreator. Here, I get the same error as Jore even though I am nowhere using msvc.

I have tried to get the newst qwt (5.3 or 6.0? the trunk from the svn) and that does not compile at all.

Does anyone know how to solve this?
Many thanks in advance!

kyamon
2nd March 2010, 15:55
I made it!
To get it to work, I had to recompile QTCreator. Which seems to confirm that the creator in the binaries is compiled using msvc while the rest has been compiled with mingw (or here it does not matter).
In any case, all you have to do is download the QTCreator source (from trolltech), compile it from within the running (old) creator using mingw and then start it. Don't forget to set the PATH variable as it is supposed to be and you are good to go.

This is an EXTREMELY annoying problem, although I believe there is no one to blame really. But it would be nice if it could be documented somewhere, for QT as well as for qwt!

EliGri
3rd March 2010, 16:49
Thank you OverTheOcean - commenting line 48 in qwt_valuelist.h fixed this compile plroblem in MS VS2005

Uwe
3rd March 2010, 17:23
This is an EXTREMELY annoying problem, although I believe there is no one to blame really. But it would be nice if it could be documented somewhere, for QT as well as for qwt!
Ok you believe Qt creator is not able to build Qt applications with a different compiler, than the one it had been build with. I can imagine, that it is not true when you carefully avoid using the wrong libs - but anyway.

What exactly do you expect from the documentation of a library like Qwt - a note indicating, that you shouldn't try to link binaries built from incompatible compilers ?

On Linux systems you have a distribution ( and package maintainers ) taking care of dependencies and possible incompatibilities. Even if you don't know, what you are doing you can always trust on it. Unfortunately on Windows the idea of a distribution doesn't exist. In combination with other pointless problems ( like debug/release incompatibilities or this __declspec stuff, what was the reason for the qHash problem ) Windows is by far the most difficult development environment - what can be seen easily from the number of problems reported here.

Uwe

PS: Please start a new thread if you want to discuss something different. Nobody will expect to find your hint in a thread about qHash.