• 11012阅读
  • 10回复

[提问]安装QWT时nmake错误,要如何解决? [复制链接]

上一主题 下一主题
离线aichibanli
 
只看楼主 倒序阅读 楼主  发表于: 2010-01-20
— 本帖被 XChinux 从 Qt基础编程 移动到本区(2011-01-07) —
NMAKE : fatal error U1077: '"D:\Program Files\Microsoft Visual Studio 9.0\VC\BIN
\cl.EXE"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"D:\Program Files\Microsoft Visual Studio 9.0\VC\BIN
\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'


我在编译QWT时,出现错误,说是要改环境变量,我还是不清楚,能否给个详细说明,谢谢了~~
离线dbzhang800

只看该作者 1楼 发表于: 2010-01-20
贴的信息没多大用,从此处往上看,找到编译错误信息,贴出来看看
离线aichibanli
只看该作者 2楼 发表于: 2010-01-20
c:\qt\4.6.0\include\qtcore\../../src/corelib/tools/qhash.h(875) : error C2668: '
qHash' : ambiguous call to overloaded function
        c:\qt\4.6.0\include\qtcore\../../src/corelib/tools/qhash.h(86): could be
'uint qHash(qint64)'
        c:\qt\4.6.0\include\qtcore\../../src/corelib/tools/qhash.h(78): or
'uint qHash(quint64)'
        c:\qt\4.6.0\include\qtcore\../../src/corelib/tools/qhash.h(77): or
'uint qHash(long)'
        c:\qt\4.6.0\include\qtcore\../../src/corelib/tools/qhash.h(69): or
'uint qHash(ulong)'
        c:\qt\4.6.0\include\qtcore\../../src/corelib/tools/qhash.h(68): or
'uint qHash(int)'
        c:\qt\4.6.0\include\qtcore\../../src/corelib/tools/qhash.h(67): or
'uint qHash(uint)'
        c:\qt\4.6.0\include\qtcore\../../src/corelib/tools/qhash.h(66): or
'uint qHash(short)'
        c:\qt\4.6.0\include\qtcore\../../src/corelib/tools/qhash.h(65): or
'uint qHash(ushort)'
        c:\qt\4.6.0\include\qtcore\../../src/corelib/tools/qhash.h(64): or
'uint qHash(signed char)'
        c:\qt\4.6.0\include\qtcore\../../src/corelib/tools/qhash.h(63): or
'uint qHash(uchar)'
        c:\qt\4.6.0\include\qtcore\../../src/corelib/tools/qhash.h(62): or
'uint qHash(char)'
        while trying to match the argument list '(const qreal)'
        c:\qt\4.6.0\include\qtcore\../../src/corelib/tools/qhash.h(873) : while
compiling class template member function 'QHashNode<Key,T> **QHash<Key,T>::findN
ode(const Key &,uint *) const'
        with
        [
            Key=qreal,
            T=QHashDummyValue
        ]
        c:\qt\4.6.0\include\qtcore\../../src/corelib/tools/qhash.h(748) : while
compiling class template member function 'QHash<Key,T>::iterator QHash<Key,T>::i
nsert(const Key &,const T &)'
        with
        [
            Key=qreal,
            T=QHashDummyValue
        ]
        c:\qt\4.6.0\include\qtcore\../../src/corelib/tools/qset.h(233) : see ref
erence to class template instantiation 'QHash<Key,T>' being compiled
        with
        [
            Key=qreal,
            T=QHashDummyValue
        ]
        c:\qt\4.6.0\include\qtcore\../../src/corelib/tools/qset.h(305) : see ref
erence to class template instantiation 'QSet<T>' being compiled
        with
        [
            T=qreal
        ]
        c:\qt\4.6.0\include\qtcore\../../src/corelib/tools/qset.h(305) : while c
ompiling class template member function 'QSet<T> QList<T>::toSet(void) const'
        with
        [
            T=qreal
        ]
        c:\qwt-5.2.0\src\qwt_valuelist.h(48) : see reference to class template i
nstantiation 'QList<T>' being compiled
        with
        [
            T=qreal
        ]


有几处都是这样的错误信息
离线dbzhang800

只看该作者 3楼 发表于: 2010-01-20
打开 qwt_valuelist.h

注意下面的代码,
  1. ...
  2. #if QT_VERSION < 0x040300
  3. // Some compilers have problems,
  4. // without a qHash(double) implementation
  5. #include <qset.h>
  6. #include <qvector.h>
  7. inline uint qHash(double key) { return uint(key); }
  8. #endif
  9. ...
离线aichibanli
只看该作者 4楼 发表于: 2010-01-20
什么意思?要改吗?
离线dbzhang800

只看该作者 5楼 发表于: 2010-01-21
对,你前面的错误不就是找不到这个重载函数么
离线aichibanli
只看该作者 6楼 发表于: 2010-01-21
这是QWT的头文件,我也要改吗?
离线dbzhang800

只看该作者 7楼 发表于: 2010-01-21
不改不能用时,当然就要考虑改了。

只需把 0x040300 改成比你当前版本高即可(比如改成低于Qt4.7而不是4.3) 0x040700

或者直接注释掉 #if 和 #endif这两行
离线aichibanli
只看该作者 8楼 发表于: 2010-01-22
dbzhang800
我照你说的,改后,编译完成了,在QWT的LIB目录下,有qwt5.dll,qwt5.lib和qwt5.exp
我想请问,我打开QWT的例子后,报LINK错误,请问要把DLL放到QT里吗?
离线dbzhang800

只看该作者 9楼 发表于: 2010-01-22
引用第8楼aichibanli于2010-01-22 15:35发表的  :
dbzhang800
我照你说的,改后,编译完成了,在QWT的LIB目录下,有qwt5.dll,qwt5.lib和qwt5.exp
我想请问,我打开QWT的例子后,报LINK错误,请问要把DLL放到QT里吗?


建议以后发帖时贴出具体的出错信息。

你运行例子的话,至少要把 qwt5.dll 放到程序找到的地方(比如和exe放一块,或系统PATH中的任何一个目录)
离线aichibanli
只看该作者 10楼 发表于: 2010-01-25
解决了,在次谢谢  dbzhang800
快速回复
限100 字节
 
上一个 下一个