环境:Ubuntu 8.04 + Qt4.7.3静态编译。
(这个环境曾经成功编译过其他的QT程序,所以不应该有问题哇)
qmake -o Makefile生成Makefile。
make的时候报类似如下的错误:
In file included from /usr/local/Trolltech/Qt-4.7.3/include/QtGui/qwidget.h:45,
from /usr/local/Trolltech/Qt-4.7.3/include/QtGui/QWidget:1,
from ./time.h:4,
from /usr/include/sys/types.h:133,
from /usr/include/stdlib.h:320,
from /usr/include/c++/4.2/cstdlib:72,
from /usr/include/c++/4.2/bits/stl_algobase.h:68,
from /usr/include/c++/4.2/bits/char_traits.h:46,
from /usr/include/c++/4.2/string:47,
from /usr/local/Trolltech/Qt-4.7.3/include/QtCore/qstring.h:60,
from /usr/local/Trolltech/Qt-4.7.3/include/QtCore/qobject.h:48,
from /usr/local/Trolltech/Qt-4.7.3/include/QtCore/qcoreapplication.h:45,
from /usr/local/Trolltech/Qt-4.7.3/include/QtGui/qapplication.h:45,
from /usr/local/Trolltech/Qt-4.7.3/include/QtGui/QApplication:1,
from main.cpp:1:
/usr/local/Trolltech/Qt-4.7.3/include/QtGui/qwindowdefs.h:89: error: template with C linkage
/usr/local/Trolltech/Qt-4.7.3/include/QtGui/qwindowdefs.h:142: error: template with C linkage
/usr/local/Trolltech/Qt-4.7.3/include/QtGui/qwindowdefs.h:145: error: template with C linkage
In file included from /usr/local/Trolltech/Qt-4.7.3/include/QtGui/qwidget.h:47,
from /usr/local/Trolltech/Qt-4.7.3/include/QtGui/QWidget:1,
from ./time.h:4,
from /usr/include/sys/types.h:133,
from /usr/include/stdlib.h:320,
from /usr/include/c++/4.2/cstdlib:72,
from /usr/include/c++/4.2/bits/stl_algobase.h:68,
from /usr/include/c++/4.2/bits/char_traits.h:46,
from /usr/include/c++/4.2/string:47,
from /usr/local/Trolltech/Qt-4.7.3/include/QtCore/qstring.h:60,
from /usr/local/Trolltech/Qt-4.7.3/include/QtCore/qobject.h:48,
from /usr/local/Trolltech/Qt-4.7.3/include/QtCore/qcoreapplication.h:45,
from /usr/local/Trolltech/Qt-4.7.3/include/QtGui/qapplication.h:45,
from /usr/local/Trolltech/Qt-4.7.3/include/QtGui/QApplication:1,
from main.cpp:1:
/usr/local/Trolltech/Qt-4.7.3/include/QtCore/qmargins.h:81: error: template specialization with C linkage
In file included from /usr/local/Trolltech/Qt-4.7.3/include/QtCore/qrect.h:45,
from /usr/local/Trolltech/Qt-4.7.3/include/QtGui/qpaintdevice.h:46,
from /usr/local/Trolltech/Qt-4.7.3/include/QtGui/qwidget.h:48,
from /usr/local/Trolltech/Qt-4.7.3/include/QtGui/QWidget:1,
from ./time.h:4,
from /usr/include/sys/types.h:133,
from /usr/include/stdlib.h:320,
from /usr/include/c++/4.2/cstdlib:72,
from /usr/include/c++/4.2/bits/stl_algobase.h:68,
from /usr/include/c++/4.2/bits/char_traits.h:46,
from /usr/include/c++/4.2/string:47,
from /usr/local/Trolltech/Qt-4.7.3/include/QtCore/qstring.h:60,
from /usr/local/Trolltech/Qt-4.7.3/include/QtCore/qobject.h:48,
from /usr/local/Trolltech/Qt-4.7.3/include/QtCore/qcoreapplication.h:45,
from /usr/local/Trolltech/Qt-4.7.3/include/QtGui/qapplication.h:45,
from /usr/local/Trolltech/Qt-4.7.3/include/QtGui/QApplication:1,
from main.cpp:1:
/usr/local/Trolltech/Qt-4.7.3/include/QtCore/qsize.h:83: error: declaration of C function ‘bool operator==(const QSize&, const QSize&)’ conflicts with
/usr/local/Trolltech/Qt-4.7.3/include/QtCore/qmargins.h:121: error: previous declaration ‘bool operator==(const QMargins&, const QMargins&)’ here
/usr/local/Trolltech/Qt-4.7.3/include/QtCore/qsize.h:84: error: declaration of C function ‘bool operator!=(const QSize&, const QSize&)’ conflicts with
/usr/local/Trolltech/Qt-4.7.3/include/QtCore/qmargins.h:130: error: previous declaration ‘bool operator!=(const QMargins&, const QMargins&)’ here
/usr/local/Trolltech/Qt-4.7.3/include/QtCore/qsize.h:88: error: declaration of C function ‘const QSize operator*(qreal, const QSize&)’ conflicts with
/usr/local/Trolltech/Qt-4.7.3/include/QtCore/qsize.h:87: error: previous declaration ‘const QSize operator*(const QSize&, qreal)’ here
/usr/local/Trolltech/Qt-4.7.3/include/QtCore/qsize.h:95: error: template specialization with C linkage
/usr/local/Trolltech/Qt-4.7.3/include/QtCore/qsize.h:102: error: declaration of C function ‘QDataStream& operator<<(QDataStream&, const QSize&)’ conflicts with
/usr/local/Trolltech/Qt-4.7.3/include/QtCore/qmargins.h:140: error: previous declaration ‘QDebug operator<<(QDebug, const QMargins&)’ here
/usr/local/Trolltech/Qt-4.7.3/include/QtCore/qsize.h: In function ‘const QSize operator*(const QSize&, qreal)’:
/usr/local/Trolltech/Qt-4.7.3/include/QtCore/qsize.h:168: error: declaration of C function ‘const QSize operator*(const QSize&, qreal)’ conflicts with
/usr/local/Trolltech/Qt-4.7.3/include/QtCore/qsize.h:88: error: previous declaration ‘const QSize operator*(qreal, const QSize&)’ here
/usr/local/Trolltech/Qt-4.7.3/include/QtCore/qsize.h: In function ‘const QSize operator*(qreal, const QSize&)’:
/usr/local/Trolltech/Qt-4.7.3/include/QtCore/qsize.h:171: error: declaration of C function ‘const QSize operator*(qreal, const QSize&)’ conflicts with
/usr/local/Trolltech/Qt-4.7.3/include/QtCore/qsize.h:168: error: previous declaration ‘const QSize operator*(const QSize&, qreal)’ here
/usr/local/Trolltech/Qt-4.7.3/include/QtCore/qsize.h: At global scope:
/usr/local/Trolltech/Qt-4.7.3/include/QtCore/qsize.h:198: error: declaration of C function ‘QDebug operator<<(QDebug, const QSize&)’ conflicts with
/usr/local/Trolltech/Qt-4.7.3/include/QtCore/qsize.h:102: error: previous declaration ‘QDataStream& operator<<(QDataStream&, const QSize&)’ here
/usr/local/Trolltech/Qt-4.7.3/include/QtCore/qsize.h:233: error: declaration of C function ‘bool operator==(const QSizeF&, const QSizeF&)’ conflicts with
/usr/local/Trolltech/Qt-4.7.3/include/QtCore/qsize.h:156: error: previous declaration ‘bool operator==(const QSize&, const QSize&)’ here
/usr/local/Trolltech/Qt-4.7.3/include/QtCore/qsize.h:234: error: declaration of C function ‘bool operator!=(const QSizeF&, const QSizeF&)’ conflicts with
/usr/local/Trolltech/Qt-4.7.3/include/QtCore/qsize.h:159: error: previous declaration ‘bool operator!=(const QSize&, const QSize&)’ here
/usr/local/Trolltech/Qt-4.7.3/include/QtCore/qsize.h:235: error: declaration of C function ‘const QSizeF operator+(const QSizeF&, const QSizeF&)’ conflicts with
/usr/local/Trolltech/Qt-4.7.3/include/QtCore/qsize.h:162: error: previous declaration ‘const QSize operator+(const QSize&, const QSize&)’ here
/usr/local/Trolltech/Qt-4.7.3/include/QtCore/qsize.h:236: error: declaration of C function ‘const QSizeF operator-(const QSizeF&, const QSizeF&)’ conflicts with
/usr/local/Trolltech/Qt-4.7.3/include/QtCore/qsize.h:165: error: previous declaration ‘const QSize operator-(const QSize&, const QSize&)’ here
/usr/local/Trolltech/Qt-4.7.3/include/QtCore/qsize.h:237: error: declaration of C function ‘const QSizeF operator*(const QSizeF&, qreal)’ conflicts with
/usr/local/Trolltech/Qt-4.7.3/include/QtCore/qsize.h:171: error: previous declaration ‘const QSize operator*(qreal, const QSize&)’ here
/usr/local/Trolltech/Qt-4.7.3/include/QtCore/qsize.h:238: error: declaration of C function ‘const QSizeF operator*(qreal, const QSizeF&)’ conflicts with
/usr/local/Trolltech/Qt-4.7.3/include/QtCore/qsize.h:237: error: previous declaration ‘const QSizeF operator*(const QSizeF&, qreal)’ here
/usr/local/Trolltech/Qt-4.7.3/include/QtCore/qsize.h:239: error: declaration of C function ‘const QSizeF operator/(const QSizeF&, qreal)’ conflicts with
/usr/local/Trolltech/Qt-4.7.3/include/QtCore/qsize.h:181: error: previous declaration ‘const QSize operator/(const QSize&, qreal)’ here
/usr/local/Trolltech/Qt-4.7.3/include/QtCore/qsize.h:247: error: template specialization with C linkage
/usr/local/Trolltech/Qt-4.7.3/include/QtCore/qsize.h:255: error: declaration of C function ‘QDataStream& operator<<(QDataStream&, const QSizeF&)’ conflicts with
/usr/local/Trolltech/Qt-4.7.3/include/QtCore/qsize.h:198: error: previous declaration ‘QDebug operator<<(QDebug, const QSize&)’ here
/usr/local/Trolltech/Qt-4.7.3/include/QtCore/qsize.h:256: error: declaration of C function ‘QDataStream& operator>>(QDataStream&, QSizeF&)’ conflicts with
/usr/local/Trolltech/Qt-4.7.3/include/QtCore/qsize.h:103: error: previous declaration ‘QDataStream& operator>>(QDataStream&, QSize&)’ here
/usr/local/Trolltech/Qt-4.7.3/include/QtCore/qsize.h: In function ‘const QSizeF operator*(const QSizeF&, qreal)’:
/usr/local/Trolltech/Qt-4.7.3/include/QtCore/qsize.h:326: error: declaration of C function ‘const QSizeF operator*(const QSizeF&, qreal)’ conflicts with
/usr/local/Trolltech/Qt-4.7.3/include/QtCore/qsize.h:238: error: previous declaration ‘const QSizeF operator*(qreal, const QSizeF&)’ here
/usr/local/Trolltech/Qt-4.7.3/include/QtCore/qsize.h: In function ‘const QSizeF operator*(qreal, const QSizeF&)’:
/usr/local/Trolltech/Qt-4.7.3/include/QtCore/qsize.h:329: error: declaration of C function ‘const QSizeF operator*(qreal, const QSizeF&)’ conflicts with
/usr/local/Trolltech/Qt-4.7.3/include/QtCore/qsize.h:326: error: previous declaration ‘const QSizeF operator*(const QSizeF&, qreal)’ here
/usr/local/Trolltech/Qt-4.7.3/include/QtCore/qsize.h: At global scope:
/usr/local/Trolltech/Qt-4.7.3/include/QtCore/qsize.h:361: error: declaration of C function ‘QDebug operator<<(QDebug, const QSizeF&)’ conflicts with
/usr/local/Trolltech/Qt-4.7.3/include/QtCore/qsize.h:255: error: previous declaration ‘QDataStream& operator<<(QDataStream&, const QSizeF&)’ here
(后面还有许多)
非常迷惑,搜了很多也没有答案,求助ing。