Results 1 to 5 of 5

Thread: static building qt, error: declaration of c function conflicts

  1. #1
    Join Date
    Jan 2009
    Posts
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default static building qt, error: declaration of c function conflicts

    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

  2. #2
    Join Date
    Jan 2009
    Posts
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: static building qt, error: declaration of c function conflicts

    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

  3. #3
    Join Date
    Jan 2009
    Posts
    54
    Thanks
    9
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: static building qt, error: declaration of c function conflicts

    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.

  4. #4
    Join Date
    Jun 2010
    Posts
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: static building qt, error: declaration of c function conflicts

    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?

  5. #5
    Join Date
    Jul 2010
    Posts
    72
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4 Qt/Embedded Qt Jambi
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: static building qt, error: declaration of c function conflicts

    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
    ?

Similar Threads

  1. QPSQL problem
    By LoneWolf in forum Installation and Deployment
    Replies: 60
    Last Post: 4th November 2009, 15:22
  2. QPSQL driver in windows
    By brevleq in forum Installation and Deployment
    Replies: 31
    Last Post: 14th December 2007, 13:57
  3. how to add static library into qmake
    By Namrata in forum Qt Tools
    Replies: 1
    Last Post: 20th November 2007, 18:33
  4. use qpsql
    By raphaelf in forum Installation and Deployment
    Replies: 34
    Last Post: 22nd August 2006, 13:52
  5. I got two problems when I used static compiled library of QT4
    By qintm in forum Installation and Deployment
    Replies: 8
    Last Post: 20th April 2006, 09:52

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.