我有編制的Qt框架版本4.1.4的源的問題。 (請參閱附加的圖片,以獲得精確的編譯器錯誤文本)的Qt 4.1.4源代碼編譯在Windows上使用MinGW
我正在使用Qt的這個源代碼(http://get.qt.nokia.com/qt/source/qt-win-opensource-src-4.1.4 .ZIP)
而且我使用MinGW的(從這裏http://sourceforge.net/projects/mingw/files/),其中有GCC版本4.5.0.1
要我最新似乎有些函數原型是qatomic.h
diff和GCC包括winbase.h
,它可能是由於Qt 4.1.4有點舊。
誰能告訴我怎麼解決這個問題呢? 通過更改MinGW版本?或者其他一些環境設置?
這將是很好,如果有人已經成功地在過去編譯的Qt 4.1.4使用MinGW,那麼請讓我知道MinGW和GCC的版本中使用?
編譯器輸出:
D:\Qt\qt-win-opensource-src-4.1.4>mingw32-make
cd src && mingw32-make -f Makefile
mingw32-make[1]: Entering directory `D:/Qt/qt-win-opensource-src-4.1.4/src'
cd winmain && mingw32-make -f Makefile
mingw32-make[2]: Entering directory `D:/Qt/qt-win-opensource-src-4.1.4/src/winma
in'
mingw32-make -f Makefile.Debug all
mingw32-make[3]: Entering directory `D:/Qt/qt-win-opensource-src-4.1.4/src/winma
in'
g++ -c -g -g -Wall -frtti -fexceptions -DQT_THREAD_SUPPORT -DUNICODE -DQT_LARGEF
ILE_SUPPORT -DQT_NEEDS_QMAIN -DQT_NO_CAST_TO_ASCII -DQT3_SUPPORT -DQT_MOC_COMPAT
-I"D:/Qt/qt-win-opensource-src-4.1.4/include" -I"tmp" -I"D:/Qt/qt-win-opensourc
e-src-4.1.4/include/QtCore" -I"d:\Qt\qt-win-opensource-src-4.1.4\include\qtmain"
-I"tmp" -I"D:/Qt/qt-win-opensource-src-4.1.4/include/ActiveQt" -I"tmp\moc\debug
_shared" -I"." -I"..\..\mkspecs\win32-g++" -o tmp\obj\debug_shared\qtmain_win.o
qtmain_win.cpp
In file included from D:/Qt/qt-win-opensource-src-4.1.4/include/QtCore/arch/qato
mic.h:1:0,
from D:/Qt/qt-win-opensource-src-4.1.4/include/QtCore/../../src
/corelib/thread/qatomic.h:31,
from D:/Qt/qt-win-opensource-src-4.1.4/include/QtCore/qatomic.h
:1,
from D:/Qt/qt-win-opensource-src-4.1.4/include/QtCore/../../src
/corelib/tools/qbytearray.h:28,
from D:/Qt/qt-win-opensource-src-4.1.4/include/QtCore/qbytearra
y.h:1,
from qtmain_win.cpp:25:
D:/Qt/qt-win-opensource-src-4.1.4/include/QtCore/arch/../../../src/corelib/arch/
windows/arch/qatomic.h:154:87: error: declaration of C function 'long int Interl
ockedCompareExchange(long int*, long int, long int)' conflicts with
c:\mingw\bin\../lib/gcc/mingw32/4.5.0/../../../../include/winbase.h:1689:13: err
or: previous declaration 'LONG InterlockedCompareExchange(volatile LONG*, LONG,
LONG)' here
D:/Qt/qt-win-opensource-src-4.1.4/include/QtCore/arch/../../../src/corelib/arch/
windows/arch/qatomic.h:155:69: error: declaration of C function 'long int Interl
ockedIncrement(long int*)' conflicts with
c:\mingw\bin\../lib/gcc/mingw32/4.5.0/../../../../include/winbase.h:1702:13: err
or: previous declaration 'LONG InterlockedIncrement(volatile LONG*)' here
D:/Qt/qt-win-opensource-src-4.1.4/include/QtCore/arch/../../../src/corelib/arch/
windows/arch/qatomic.h:156:69: error: declaration of C function 'long int Interl
ockedDecrement(long int*)' conflicts with
c:\mingw\bin\../lib/gcc/mingw32/4.5.0/../../../../include/winbase.h:1693:13: err
or: previous declaration 'LONG InterlockedDecrement(volatile LONG*)' here
D:/Qt/qt-win-opensource-src-4.1.4/include/QtCore/arch/../../../src/corelib/arch/
windows/arch/qatomic.h:157:74: error: declaration of C function 'long int Interl
ockedExchange(long int*, long int)' conflicts with
c:\mingw\bin\../lib/gcc/mingw32/4.5.0/../../../../include/winbase.h:1694:13: err
or: previous declaration 'LONG InterlockedExchange(volatile LONG*, LONG)' here
mingw32-make[3]: *** [tmp\obj\debug_shared\qtmain_win.o] Error 1
mingw32-make[3]: Leaving directory `D:/Qt/qt-win-opensource-src-4.1.4/src/winmai
n'
mingw32-make[2]: *** [debug-all] Error 2
mingw32-make[2]: Leaving directory `D:/Qt/qt-win-opensource-src-4.1.4/src/winmai
n'
mingw32-make[1]: *** [sub-winmain-make_default-ordered] Error 2
mingw32-make[1]: Leaving directory `D:/Qt/qt-win-opensource-src-4.1.4/src'
mingw32-make: *** [sub-src-make_default-ordered] Error 2
你介意我問你爲什麼使用4.1嗎?你的應用程序不適用於更新版本的qt嗎? – 2010-10-08 09:29:31
我上有QT4.6性能問題(截至目前)的一個項目工作,我們需要移植的代碼正確和改變某些部分的工具與QT4.6正常工作,但這是計劃的後續版本項目。所以現在我堅持使用QT 4.1.4。 – Chirag 2010-10-08 10:19:01