PDA

View Full Version : static building qt, error: declaration of c function conflicts



BlueWizard
7th January 2009, 16:29
Hello,

I'm trying to build Qt statically with the latest version of mingw (in windows), I followed the Qt help section "Deploying an Application on Qt/Windows"
to build Qt staically, but the process is stopped by few errors.

The 'configure -static' worked but mingw32-make fails with these errors, can you help please? Thanks in advance.

For info: I'm using the latest version of MinGW packages
(updated to december/08):

C:\dev\qt\4.4.3>configure -static
...
...
...
Reading C:/dev/qt/4.4.3/demos/qtdemo/qtdemo.pro
Reading C:/dev/qt/4.4.3/demos/browser/browser.pro
Reading C:/dev/qt/4.4.3/tools/qdoc3/qdoc3.pro

Qt is now configured for building. Just run mingw32-make.
To reconfigure, run mingw32-make confclean and configure.


C:\dev\qt\4.4.3>mingw32-make sub-src
cd src\winmain\ && mingw32-make
mingw32-make[1]: Entering directory `C:/dev/qt/4.4.3/src/winmain'
mingw32-make -f Makefile.Debug all
mingw32-make[2]: Entering directory `C:/dev/qt/4.4.3/src/winmain'
g++ -c -g -Wall -frtti -fexceptions -mthreads -DQT_THREAD_SUPPORT -DUNICODE -DQT
_LARGEFILE_SUPPORT -DQT_NEEDS_QMAIN -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNIN
GS -DQT3_SUPPORT -DQT_MOC_COMPAT -D_USE_MATH_DEFINES -I"..\..\include" -I"tmp" -
I"..\..\include\QtCore" -I"c:\dev\qt\4.4.3\include\qtmain" -I"tmp\rcc\debug_stat
ic" -I"tmp" -I"c:\dev\qt\4.4.3\include\ActiveQt" -I"tmp\moc\debug_static" -I"."
-I"..\..\mkspecs\win32-g++" -o tmp\obj\debug_static\qtmain_win.o qtmain_win.cpp
In file included from ../../include/QtCore/qatomic_windows.h:1,
from ../../include/QtCore/../../src/corelib/arch/qatomic_arch.h
:72,
from ../../include/QtCore/qatomic_arch.h:1,
from ../../include/QtCore/../../src/corelib/thread/qbasicatomic
.h:203,
from ../../include/QtCore/qbasicatomic.h:1,
from ../../include/QtCore/../../src/corelib/thread/qatomic.h:42
,
from ../../include/QtCore/qatomic.h:1,
from ../../include/QtCore/../../src/corelib/tools/qbytearray.h:
42,
from ../../include/QtCore/qbytearray.h:1,
from qtmain_win.cpp:39:
../../include/QtCore/../../src/corelib/arch/qatomic_windows.h:387: error: declar
ation of C function `long int InterlockedCompareExchange(long int*, long int, lo
ng int)' conflicts with
c:/dev/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/winbase.h:1681: er
ror: previous declaration `LONG InterlockedCompareExchange(volatile LONG*, LONG,
LONG)' here
../../include/QtCore/../../src/corelib/arch/qatomic_windows.h:388: error: declar
ation of C function `long int InterlockedIncrement(long int*)' conflicts with
c:/dev/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/winbase.h:1694: er
ror: previous declaration `LONG InterlockedIncrement(volatile LONG*)' here
../../include/QtCore/../../src/corelib/arch/qatomic_windows.h:389: error: declar
ation of C function `long int InterlockedDecrement(long int*)' conflicts with
c:/dev/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/winbase.h:1685: er
ror: previous declaration `LONG InterlockedDecrement(volatile LONG*)' here
../../include/QtCore/../../src/corelib/arch/qatomic_windows.h:390: error: declar
ation of C function `long int InterlockedExchange(long int*, long int)' conflict
s with
c:/dev/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/winbase.h:1686: er
ror: previous declaration `LONG InterlockedExchange(volatile LONG*, LONG)' here
../../include/QtCore/../../src/corelib/arch/qatomic_windows.h:391: error: declar
ation of C function `long int InterlockedExchangeAdd(long int*, long int)' confl
icts with
c:/dev/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/winbase.h:1690: er
ror: previous declaration `LONG InterlockedExchangeAdd(volatile LONG*, LONG)' he
re
mingw32-make[2]: *** [tmp/obj/debug_static/qtmain_win.o] Error 1
mingw32-make[2]: Leaving directory `C:/dev/qt/4.4.3/src/winmain'
mingw32-make[1]: *** [debug-all] Error 2
mingw32-make[1]: Leaving directory `C:/dev/qt/4.4.3/src/winmain'
mingw32-make: *** [sub-winmain-sub_src_target_ordered] Error 2

C:\dev\qt\4.4.3>

================================================== =============================
================================================== =============================

After that, I tried to build Qt using this "mingw32-make -B -i sub-src" (i.e.
ignoring those errors) and waiting about 3 hours, then I opened eclipse environement and tried to
compile a simple project. I have these 2 errors
(..\mingw32\bin\ld.exe: cannot find -lQtGuid collect2:
ld returned 1 exit status)

mingw32-make debug
mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory `C:/Documents and Settings/BlueWizard/My
Documents/eclipse_workspace/saverio1'
c:\dev\qt\4.4.3\bin\uic.exe saverio1.ui -o ui_saverio1.h
g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT
-DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN
-I"c:\dev\qt\4.4.3\include\QtCore" -I"c:\dev\qt\4.4.3\include\QtCore"
-I"c:\dev\qt\4.4.3\include\QtGui" -I"c:\dev\qt\4.4.3\include\QtGui"
-I"c:\dev\qt\4.4.3\include" -I"c:\dev\qt\4.4.3\include\ActiveQt" -I"debug" -I"."
-I"c:\dev\qt\4.4.3\mkspecs\default" -o debug\main.o main.cpp
g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT
-DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN
-I"c:\dev\qt\4.4.3\include\QtCore" -I"c:\dev\qt\4.4.3\include\QtCore"
-I"c:\dev\qt\4.4.3\include\QtGui" -I"c:\dev\qt\4.4.3\include\QtGui"
-I"c:\dev\qt\4.4.3\include" -I"c:\dev\qt\4.4.3\include\ActiveQt" -I"debug" -I"."
-I"c:\dev\qt\4.4.3\mkspecs\default" -o debug\saverio1.o saverio1.cpp
C:/dev/qt/4.4.3/bin\moc.exe -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_GUI_LIB
-DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN
-I"c:\dev\qt\4.4.3\include\QtCore" -I"c:\dev\qt\4.4.3\include\QtCore"
-I"c:\dev\qt\4.4.3\include\QtGui" -I"c:\dev\qt\4.4.3\include\QtGui"
-I"c:\dev\qt\4.4.3\include" -I"c:\dev\qt\4.4.3\include\ActiveQt" -I"debug" -I"."
-I"c:\dev\qt\4.4.3\mkspecs\default" -D__GNUC__ -DWIN32 saverio1.h -o
debug\moc_saverio1.cpp
g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT
-DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN
-I"c:\dev\qt\4.4.3\include\QtCore" -I"c:\dev\qt\4.4.3\include\QtCore"
-I"c:\dev\qt\4.4.3\include\QtGui" -I"c:\dev\qt\4.4.3\include\QtGui"
-I"c:\dev\qt\4.4.3\include" -I"c:\dev\qt\4.4.3\include\ActiveQt" -I"debug" -I"."
-I"c:\dev\qt\4.4.3\mkspecs\default" -o debug\moc_saverio1.o
debug\moc_saverio1.cpp
g++ -enable-stdcall-fixup -Wl,-enable-auto-import
-Wl,-enable-runtime-pseudo-reloc -mthreads -Wl -Wl,-subsystem,windows -o
debug\saverio1.exe debug/main.o debug/saverio1.o debug/moc_saverio1.o
-L"c:\dev\qt\4.4.3\lib" -lmingw32 -lqtmaind -lQtGuid -lgdi32 -lcomdlg32
-loleaut32 -limm32 -lwinmm -lwinspool -lmsimg32 -lQtCored -lkernel32 -luser32
-lshell32 -luuid -lole32 -ladvapi32 -lws2_32
c:\dev\mingw\bin\..\lib\gcc\mingw32\3.4.5\..\..\.. \..\mingw32\bin\ld.exe: cannot
find -lQtGuid
collect2: ld returned 1 exit status
mingw32-make[1]: Leaving directory `C:/Documents and Settings/BlueWizard/My
Documents/eclipse_workspace/saverio1'
mingw32-make[1]: *** [debug\saverio1.exe] Error 1
mingw32-make: *** [debug] Error 2

BlueWizard
13th January 2009, 09:52
ok, I have solved this problem.

The solution consists in modifying the winbase.h, parts that contain the 'volatile' type modifier near the formal parameter declaration in a few functions.

Kind Regards

adamatic
25th January 2009, 18:13
Hello.

I have the some problem, could you explain more how modify the winbase.h?, because I don't have any volatile type in my winbase.h.

Thank you.

nnnazareno
25th June 2010, 04:05
I also have the same problem.
I found the winbase.h in MinGW but I don't know how to configure it.
Please explain how to configure it?

freely
30th July 2010, 12:50
Hi
From yesterday I begin to have the problem with building Qt projects with mingw32-make in WinXP
my conf is OK
Before yesterday all was OK
I have the next error:
../serPortPlot_1/main.cpp: In function 'int qMain(int, char**)':
../serPortPlot_1/main.cpp:11: warning: no return statement in function returning non-void
mingw32-make[1]: Leaving directory `C:/PavelWork/DEV/TEST/serPortPlot_1-build-desktop'
mingw32-make: Leaving directory `C:/PavelWork/DEV/TEST/serPortPlot_1-build-desktop'
mingw32-make[1]: *** [debug/main.o] Error -1073741819
mingw32-make: *** [debug] Error 2
?