Qt - приложение требует 120 мб библиотек

Discussion in 'С/С++, C#, Rust, Swift, Go, Java, Perl, Ruby' started by eldar85, 2 Jan 2010.

  1. eldar85

    eldar85 New Member

    Joined:
    27 Aug 2009
    Messages:
    126
    Likes Received:
    1
    Reputations:
    0
    сделал гуи-приложение на Qt 4.5 по этому уроку

    http://doc.crossplatform.ru/qt/4.5.0/tutorials-addressbook.html


    из Qt Creator запускается и работает нормально
    если открыть в проводнике папку release и запустить exe оттуда - пишет что не найдена библиотека "libgcc_s_dw2-1.dll"

    нашел её в C:\Qt\2009.05\mingw\bin\

    если добавить, требует QtGui.dll и ещё 3-4 библиотеки

    проблема в том, что в итоге все вместе весит больше 120 мб!

    что я не сделал?
     
  2. POS_troi

    POS_troi Elder - Старейшина

    Joined:
    1 Dec 2006
    Messages:
    1,569
    Likes Received:
    466
    Reputations:
    108
    Скомпиль статически ;)
     
  3. eldar85

    eldar85 New Member

    Joined:
    27 Aug 2009
    Messages:
    126
    Likes Received:
    1
    Reputations:
    0
    в том то и дело что я не знаю как... можешь объяснить пошагово как че делать.
     
  4. Дикс

    Дикс Elder - Старейшина

    Joined:
    16 Apr 2006
    Messages:
    1,194
    Likes Received:
    227
    Reputations:
    26
    да, как сделать чтобы с прогой не надо было держать QtGuid4.dll - 143 мб ?
     
  5. nerezus

    nerezus Banned

    Joined:
    12 Aug 2004
    Messages:
    3,191
    Likes Received:
    727
    Reputations:
    266
    Собирать в релизе.
     
  6. eldar85

    eldar85 New Member

    Joined:
    27 Aug 2009
    Messages:
    126
    Likes Received:
    1
    Reputations:
    0
    в релизе та же хрень получается...
     
  7. \\ChaOs//

    \\ChaOs// Member

    Joined:
    26 Feb 2009
    Messages:
    102
    Likes Received:
    26
    Reputations:
    5
    В .pro допиши строчку CONFIG += release
     
  8. eldar85

    eldar85 New Member

    Joined:
    27 Aug 2009
    Messages:
    126
    Likes Received:
    1
    Reputations:
    0
    попробую спасибо! еще такой вопрос, присабачил я Qt в Eclipse - работает все отлично. Приложения также как и в Qt creator собираются, но у меня в эклипсе есть boost и libcurl, они отлично работают без Qt, хотел собрать ГУИ окно, чтобы с сетью через Курл работало, а библиотека libcurl никак не цепляется. если в обычной проге все легко - http://www.lsdeex.ru/archives/3 то когда делаешь КТ окно, так же сделать не получается. подскажите кто знает что можно сделать. как библиотеки (а именно libcurl) присоединять либо в Qt creator, а лучше в Эклипс с Qt.
     
  9. POS_troi

    POS_troi Elder - Старейшина

    Joined:
    1 Dec 2006
    Messages:
    1,569
    Likes Received:
    466
    Reputations:
    108
    Не совсем понял что ты имееш ввиду.
     
  10. eldar85

    eldar85 New Member

    Joined:
    27 Aug 2009
    Messages:
    126
    Likes Received:
    1
    Reputations:
    0
    я использовал libcurl и boost в Эклипсе в консоле все работало отлично, соединял библиотеки libcurl, boost как тут http://www.lsdeex.ru/archives/3 .Каждый раз когда начинаешь новый проект, нужно Курл вот так присоединять:

    Создай новый проект, открой его свойства Project->Properties

    Вкладка C/C++ Build -> Settings

    На вкладке Tool Settings: GCC C++ Complier -> Miscellaneous добавь флаг
    -DCURL_STATICLIB

    Чуть ниже, MinGW C++ Linker->Libraries

    добавь туда библиотеки (важен порядок в котором они расположены!)
    curl
    wsock32
    wldap32
    //==============================================================
    а теперь еще к эклипсу присоединил Qt как тут - http://habrahabr.ru/blogs/development/30636/
    тоже работает, окна собираются.

    Но если я хочу собрать окно на Qt чтобы оно использовало libcurl то Курл не получается присоединить потому что в Project->Properties нету вкладок C/C++ Build -> Settings.
    Пробывал прописывать в файле .pro LIBS += -LC:/MinGW/lib -libcurl -libcurldll но тоже не работает. не знаю что еще можно сделать...
     
  11. eldar85

    eldar85 New Member

    Joined:
    27 Aug 2009
    Messages:
    126
    Likes Received:
    1
    Reputations:
    0
    и вот так пробывал LIBS += -LC:/MinGW/lib -libcurl.a -libcurldll.a и все равно #include "curl/curl.h" пишет unresolved inclision "curl/curl.h"
     
  12. \\ChaOs//

    \\ChaOs// Member

    Joined:
    26 Feb 2009
    Messages:
    102
    Likes Received:
    26
    Reputations:
    5
    Путь до хидеров укажи, либо скопируй их в %QTDIR%\include\
     
  13. eldar85

    eldar85 New Member

    Joined:
    27 Aug 2009
    Messages:
    126
    Likes Received:
    1
    Reputations:
    0
    где этот путь прописывать, тоже в .pro ???
     
  14. eldar85

    eldar85 New Member

    Joined:
    27 Aug 2009
    Messages:
    126
    Likes Received:
    1
    Reputations:
    0
    кое что начинаю понимать, библиотеки подключены(потому что во вкладке libraries есть курловские библиотеки), походу этой строкой - LIBS += -LC:\MinGW\lib -libcurl -libcurldll
    значит точно не хватает хидеров... теперь понять куда их поместить)))) или где путь прописать)))
     
  15. eldar85

    eldar85 New Member

    Joined:
    27 Aug 2009
    Messages:
    126
    Likes Received:
    1
    Reputations:
    0
    вроде разобрался, но пока не буду хвастать, пишите кто знает пока... если ща соберется все то отпишусь...
     
  16. eldar85

    eldar85 New Member

    Joined:
    27 Aug 2009
    Messages:
    126
    Likes Received:
    1
    Reputations:
    0
    фигня какая то... ни на че не ругается, curl/curl.h подключено, на него не показывает как на ошибку, ни одна строка не подчеркивается все вроде отлично, при компиляции вот такое выдает:


    mingw32-make debug
    mingw32-make -f Makefile.Debug
    mingw32-make[1]: Entering directory `C:/Users/Эл/workspace/qt4'
    g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"..\..\..\..\Qt\4.4.1\include\QtCore" -I"..\..\..\..\Qt\4.4.1\include\QtCore" -I"..\..\..\..\Qt\4.4.1\include\QtGui" -I"..\..\..\..\Qt\4.4.1\include\QtGui" -I"..\..\..\..\Qt\4.4.1\include" -I"c:\Qt\4.4.1\include\ActiveQt" -I"debug" -I"." -I"..\..\..\..\Qt\4.4.1\mkspecs\win32-g++" -o debug\main.o main.cpp
    In file included from C:/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/windows.h:50,
    from C:/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/winsock2.h:22,
    from ../../../../Qt/4.4.1/include/curl/curl.h:67,
    from main.cpp:6:
    C:/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/winbase.h:1689: error: declaration of C function `LONG InterlockedCompareExchange(volatile LONG*, LONG, LONG)' conflicts with
    ../../../../Qt/4.4.1/include/QtCore/../../src/corelib/arch/qatomic_windows.h:393: error: previous declaration `long int InterlockedCompareExchange(long int*, long int, long int)' here
    C:/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/winbase.h:1693: error: declaration of C function `LONG InterlockedDecrement(volatile LONG*)' conflicts with
    ../../../../Qt/4.4.1/include/QtCore/../../src/corelib/arch/qatomic_windows.h:395: error: previous declaration `long int InterlockedDecrement(long int*)' here
    C:/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/winbase.h:1694: error: declaration of C function `LONG InterlockedExchange(volatile LONG*, LONG)' conflicts with
    ../../../../Qt/4.4.1/include/QtCore/../../src/corelib/arch/qatomic_windows.h:396: error: previous declaration `long int InterlockedExchange(long int*, long int)' here
    C:/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/winbase.h:1698: error: declaration of C function `LONG InterlockedExchangeAdd(volatile LONG*, LONG)' conflicts with
    ../../../../Qt/4.4.1/include/QtCore/../../src/corelib/arch/qatomic_windows.h:397: error: previous declaration `long int InterlockedExchangeAdd(long int*, long int)' here
    C:/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/winbase.h:1702: error: declaration of C function `LONG InterlockedIncrement(volatile LONG*)' conflicts with
    ../../../../Qt/4.4.1/include/QtCore/../../src/corelib/arch/qatomic_windows.h:394: error: previous declaration `long int InterlockedIncrement(long int*)' here
    mingw32-make[1]: *** [debug/main.o] Error 1
    mingw32-make[1]: Leaving directory `C:/Users/Эл/workspace/qt4'
    mingw32-make: *** [debug] Error 2

    повторюсь ни одна строка кода не подчеркивается, получается не в коде проблема...
     
  17. eldar85

    eldar85 New Member

    Joined:
    27 Aug 2009
    Messages:
    126
    Likes Received:
    1
    Reputations:
    0
    в .pro файле прописал LIBS += -LC:\MinGW\lib -libcurl -libcurldll

    хедеры присоединил, воткнул папку curl (с хедерами) в Qt\4.4.1\include\curl
    библиотеки приделаны тоже, во вкладке libraries ->libcurl.a и libcurldll.a

    и все равно вот эти ошибки... ниче не пойму...
     
  18. eldar85

    eldar85 New Member

    Joined:
    27 Aug 2009
    Messages:
    126
    Likes Received:
    1
    Reputations:
    0
    ща заметил, что если убрать хедер curl/curl.h то ошибка не вылетает... конечно если там кода не написано, просто в пустой мэйн вписываю curl/curl.h - он не подчеркивает что чтото не правельно, а просто выдает при линковке такую хрень

    mingw32-make debug
    mingw32-make -f Makefile.Debug
    mingw32-make[1]: Entering directory `C:/Users/Эл/workspace/qt2'
    g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"..\..\..\..\Qt\4.4.1\include\QtCore" -I"..\..\..\..\Qt\4.4.1\include\QtCore" -I"..\..\..\..\Qt\4.4.1\include\QtGui" -I"..\..\..\..\Qt\4.4.1\include\QtGui" -I"..\..\..\..\Qt\4.4.1\include" -I"c:\Qt\4.4.1\include\ActiveQt" -I"debug" -I"." -I"..\..\..\..\Qt\4.4.1\mkspecs\win32-g++" -o debug\main.o main.cpp
    In file included from C:/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/windows.h:50,
    from C:/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/winsock2.h:22,
    from ../../../../Qt/4.4.1/include/curl/curl.h:67,
    from main.cpp:2:
    C:/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/winbase.h:1689: error: declaration of C function `LONG InterlockedCompareExchange(volatile LONG*, LONG, LONG)' conflicts with
    ../../../../Qt/4.4.1/include/QtCore/../../src/corelib/arch/qatomic_windows.h:393: error: previous declaration `long int InterlockedCompareExchange(long int*, long int, long int)' here
    C:/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/winbase.h:1693: error: declaration of C function `LONG InterlockedDecrement(volatile LONG*)' conflicts with
    ../../../../Qt/4.4.1/include/QtCore/../../src/corelib/arch/qatomic_windows.h:395: error: previous declaration `long int InterlockedDecrement(long int*)' here
    C:/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/winbase.h:1694: error: declaration of C function `LONG InterlockedExchange(volatile LONG*, LONG)' conflicts with
    ../../../../Qt/4.4.1/include/QtCore/../../src/corelib/arch/qatomic_windows.h:396: error: previous declaration `long int InterlockedExchange(long int*, long int)' here
    C:/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/winbase.h:1698: error: declaration of C function `LONG InterlockedExchangeAdd(volatile LONG*, LONG)' conflicts with
    ../../../../Qt/4.4.1/include/QtCore/../../src/corelib/arch/qatomic_windows.h:397: error: previous declaration `long int InterlockedExchangeAdd(long int*, long int)' here
    C:/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/winbase.h:1702: error: declaration of C function `LONG InterlockedIncrement(volatile LONG*)' conflicts with
    ../../../../Qt/4.4.1/include/QtCore/../../src/corelib/arch/qatomic_windows.h:394: error: previous declaration `long int InterlockedIncrement(long int*)' here
    mingw32-make[1]: *** [debug/main.o] Error 1
    mingw32-make[1]: Leaving directory `C:/Users/Эл/workspace/qt2'
    mingw32-make: *** [debug] Error 2
    а закаментываю строку #include "curl/curl.h" и все отлично... че за хрень такая...
     
    1 person likes this.
  19. Дикс

    Дикс Elder - Старейшина

    Joined:
    16 Apr 2006
    Messages:
    1,194
    Likes Received:
    227
    Reputations:
    26
    пишут что это баг Qt

    http://niftools.sourceforge.net/forum/viewtopic.php?f=4&p=15485
     
  20. eldar85

    eldar85 New Member

    Joined:
    27 Aug 2009
    Messages:
    126
    Likes Received:
    1
    Reputations:
    0
    да уж, присоединять все сложно еще и Кт походу тупое... никак не пойму...