Results 1 to 7 of 7

Thread: Qt 4.7.0 statically compiled and Qt Creator

  1. #1

    Default Qt 4.7.0 statically compiled and Qt Creator

    Hi all,

    I'm new to Qt programming. I want to develop a application based to these libraries but using static version for create a unique .exe file without the dll.
    I followed this tutorial for compile Qt in static mode:

    http://www.qtcentre.org/wiki/index.p...c_applications

    The operation seem successfull but if I try to compile the project (using Qt Creator 2.0) with these "new" libraries I receive the following error:



    Running build steps for project test...
    Configuration unchanged, skipping qmake step.
    Starting: "C:/Qt/2010.05/mingw/bin/mingw32-make.exe" -w
    mingw32-make: Entering directory `D:/Temp/qtTest/test-build-desktop'

    C:/Qt/2010.05/mingw/bin/mingw32-make -f Makefile.Release

    mingw32-make[1]: Entering directory `D:/Temp/qtTest/test-build-desktop'

    g++ -static -static-libgcc -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -Wl,-s -Wl,-subsystem,windows -o release/test.exe release/main.o release/mainwindow.o release/moc_mainwindow.o -L'c:/Qt/2010.05/qt/lib' -lmingw32 -lqtmain -lQtGui -lgdi32 -lcomdlg32 -loleaut32 -limm32 -lwinmm -lwinspool -lmsimg32 -lQtCore -lkernel32 -luser32 -lshell32 -luuid -lole32 -ladvapi32 -lws2_32

    mingw32-make[1]: Leaving directory `D:/Temp/qtTest/test-build-desktop'

    mingw32-make: Leaving directory `D:/Temp/qtTest/test-build-desktop'

    release/main.o:main.cpp: undefined reference to `_imp___ZN12QApplicationC1ERiPPci'

    release/main.o:main.cpp: undefined reference to `_imp___ZN12QApplication4execEv'

    release/main.o:main.cpp: undefined reference to `_imp___ZN12QApplicationD1Ev'

    release/main.o:main.cpp: undefined reference to `_imp___ZN12QApplicationD1Ev'

    release/moc_mainwindow.o:moc_mainwindow.cpp: undefined reference to `_imp___ZN11QMainWindow16staticMetaObjectE'

    release/moc_mainwindow.o:moc_mainwindow.cpp: undefined reference to `_imp___ZN11QMainWindow11qt_metacallEN11QMetaObjec t4CallEiPPv'

    release/moc_mainwindow.o:moc_mainwindow.cpp: undefined reference to `_imp___ZN11QMainWindow11qt_metacastEPKc'

    collect2: ld returned 1 exit status

    mingw32-make[1]: *** [release/test.exe] Error 1

    mingw32-make: *** [release] Error 2

    The process "C:/Qt/2010.05/mingw/bin/mingw32-make.exe" exited with code %2.
    Error while building project test (target: Desktop)
    When executing build step 'Make'



    I checked the wiki looking for additional settings to change in the Qt Creator but it seem the additional explanation refer to the old 1.x version.

    Someone can help me?

    Thank you

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: Qt 4.7.0 statically compiled and Qt Creator

    Show the .pro file of your project

  3. #3

    Default Re: Qt 4.7.0 statically compiled and Qt Creator

    Follow the pro file content:

    #-------------------------------------------------
    #
    # Project created by QtCreator 2010-10-11T14:03:47
    #
    #-------------------------------------------------

    QT += core gui

    TARGET = test
    TEMPLATE = app


    SOURCES += main.cpp\
    mainwindow.cpp

    HEADERS += mainwindow.h

    FORMS += mainwindow.ui

  4. #4
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: Qt 4.7.0 statically compiled and Qt Creator

    You forgot something in your .pro file.
    Read that wiki page again.

  5. #5

    Default Re: Qt 4.7.0 statically compiled and Qt Creator

    Hi

    if you refer to add the variable

    CONFIG += static

    or

    CONFIG += staticlib

    I already tried but doesn't work, same error. I missing someother?

  6. #6
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: Qt 4.7.0 statically compiled and Qt Creator

    Clean your project completely, even the Makefile (remove it)
    Then run qmake again (that is the qmake of your static Qt build)
    Then build it again.

  7. #7

    Default Re: Qt 4.7.0 statically compiled and Qt Creator

    It work! Thank you very much. I checked again the wiki but I didn't find this tip. I'm sorry if this information was present but I didn't note them....

Similar Threads

  1. Replies: 3
    Last Post: 20th September 2010, 23:36
  2. Qwt qch compiled help
    By MikeG in forum Qwt
    Replies: 4
    Last Post: 19th June 2009, 19:08
  3. Statically compiled Qt 4.1.4 and mySql
    By Djony in forum Installation and Deployment
    Replies: 1
    Last Post: 26th January 2007, 08:13
  4. Replies: 3
    Last Post: 26th July 2006, 14:23
  5. Qt is compiled statically, now what ?
    By probine in forum Qt Programming
    Replies: 1
    Last Post: 30th May 2006, 13:46

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.