Results 1 to 19 of 19

Thread: using libcurl in QT with Mingw in Windows

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2008
    Location
    Europe
    Posts
    37
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: using libcurl in QT with Mingw in Windows

    Heh, i wished I have seen your reply earlyer (-lcurldll)
    If linking -lcurl i will now get a LOT of errors about unknown symbols that appear related to ssl
    how do I link with openssl ?

    ps: how could I say print the contents of a curl reply (a page) in a QLabel (or something like that, any idea?)

  2. #2
    Join Date
    Oct 2006
    Location
    Hawaii
    Posts
    130
    Thanks
    48
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: using libcurl in QT with Mingw in Windows

    You might want to take a look at http://curl.haxx.se/docs/libs.html to see what dependencies cURL has.

    In order to use output from curl to something useful such as a QString:
    Qt Code:
    1. QString stuffFromcURL;
    2.  
    3. struct MemoryStruct chunk;
    4. chunk.memory=NULL;
    5. chunk.size = 0;
    6. //.... setting options and other stuff
    7. curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *)&chunk);
    8. //.... setting more optons
    9. //exec curl
    10. curl_easy_perform(curl_handle);
    11. stuffFromcURL = QString::fromUtf8 (chunk.memory);
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: using libcurl in QT with Mingw in Windows

    Quote Originally Posted by georgep View Post
    how do I link with openssl ?
    The same way as you link with curl (-lssl), but you need to get OpenSSL libraries first.

  4. #4
    Join Date
    May 2006
    Posts
    788
    Thanks
    49
    Thanked 48 Times in 46 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: using libcurl in QT with Mingw in Windows

    on pro file ....

    Qt Code:
    1. win32 {
    2. HEADERS += oswin32.h
    3. LIBS += C:/msys/1.0/bin/lib/libz.a
    4. LIBS += C:/msys/1.0/bin/lib/libcurl.dll.a
    5. LIBS += C:/msys/1.0/bin/lib/libcurl.a
    6. LIBS += ../all_os_lib/libexslt.a
    7. LIBS += ../all_os_lib/libxml2.a
    8. LIBS += ../all_os_lib/libxslt.a
    9.  
    10. RC_FILE = win.rc
    11. INCLUDEPATH += C:\MinGW\include C:\msys\1.0\include C:\msys\1.0\home\xml\include
    12. DEPENDPATH += include
    13. DESTDIR = ../installer
    14. }
    To copy to clipboard, switch view to plain text mode 
    i build curl on msys from mingw
    From my first qt project 2 Year a go
    http://sourceforge.net/project/scree...roup_id=167757
    https://qtexcel-xslt.svn.sourceforge...l-xslt/qexcel/

    Get remote file by curl i easy to write , whitout signal or other ..

    search on code:
    https://qtexcel-xslt.svn.sourceforge...rc/_config.cpp
    /* Warning get local file contents or remote file contents by curl */
    QString Config::file_get_contents(QString fullFileName)

  5. #5
    Join Date
    Oct 2008
    Location
    Europe
    Posts
    37
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Red face Re: using libcurl in QT with Mingw in Windows

    in my .pro file i have

    LIBS += -L"C:\Documents and Settings\Administrator\Desktop\bob\lib" -lcurl -lssl

    and when i make i get thousands of errors like:

    C:\Documents and Settings\Administrator.BOB\Desktop\bob\lib/libssl.a(t1_enc.o):t1_enc.c.text+0x1181): undefined reference to `HMAC_CTX_cleanup'

    I am guessing that it needs hmac.h (and all the other headers from the openssl directory).
    How do I #include ALL those ?

    Thank you very much for your replyes!

  6. #6
    Join Date
    Jan 2012
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: using libcurl in QT with Mingw in Windows

    in my .pro file i just used
    Qt Code:
    1. LIBS += -llibcurl
    To copy to clipboard, switch view to plain text mode 
    rather than
    Qt Code:
    1. LIBS += -lcurl
    To copy to clipboard, switch view to plain text mode 
    and BINGO! all compiles and works without errors

  7. #7
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: using libcurl in QT with Mingw in Windows

    Congratulations. Please do not reawaken 6 year old threads after 3 years of dormancy to add nothing of value.

Similar Threads

  1. A Guide to Install MinGW, Qt4 and Eclipse Integration on Windows XP
    By shiyutang in forum Installation and Deployment
    Replies: 10
    Last Post: 5th August 2009, 04:03
  2. Qt + boost + MinGW on Windows
    By akos.maroy in forum Newbie
    Replies: 3
    Last Post: 12th June 2008, 14:53
  3. Mingw very slow on windows
    By elsheikhmh in forum Installation and Deployment
    Replies: 7
    Last Post: 30th May 2007, 17:19
  4. How do I use MinGW Compiler in Windows
    By Walsi in forum General Discussion
    Replies: 3
    Last Post: 11th May 2007, 08:50
  5. qt and mingw can not run on windows 98?
    By evewei in forum Installation and Deployment
    Replies: 4
    Last Post: 26th June 2006, 09:22

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
  •  
Qt is a trademark of The Qt Company.