Yes it worked ...could you also tell why the path..I already have the path in the $PATH of the system...
Also something about the big L and why it is needed as I already have -lcurl saying curl library is being used.
Yes it worked ...could you also tell why the path..I already have the path in the $PATH of the system...
Also something about the big L and why it is needed as I already have -lcurl saying curl library is being used.
Humans make mistake because there is really NO patch for HUMAN STUPIDITY
PATH is for binaries, not libraries.Originally Posted by ct
-L<dir> tells the linker that it should look for libraries also in <dir>, while -l<lib> tells it to link with the library <lib>.Originally Posted by ct
hi,
I know the thread is old, but could you guys tell me how to compile an application with libcurl ? Its very fuzzy to me
thank you very much
Please, anyone ?
Do you have libcurl installed?
for starters,
I compiled libcurl with SSL using the instructions on their site.
then I used:
in my .pro file
then I made sure that libcurl4, libeay32.dll, and libssl32.dll were in my release directory.
then, in the file where you have code that uses curl you use:
at the top so it knows what to do, and from there, you write code using curl's commands.
One thing I recommend, is to make a separate worker thread to handle the curl commands and send signals to the main gui thread as to what it's doing. This way your gui won't become sluggish while waiting on curl to do something, and you can make nifty things like a progress bar for your curl task, or allow your user to do something else while curl is working.
Also, curl has a static callback function which pulls in the whole chunk of data that comes in. If you are looking to parse out specific data from the page, one thing you can do is make a custom callback function that looks for the piece of data you want on the fly and then curl will only return exactly what you want, rather than making you parse the whole page later.
First, thank you for replying !
What does installing libcurl mean? I downloaded the curl-7.19-devel-mingw package and copyed from that to my project directory.
I get the error:
c:/Documents and Settings/Administrator/Desktop/bob/hello.cpp:19: undefined reference to `_imp__curl_easy_init'
c:/Documents and Settings/Administrator/Desktop/bob/hello.cpp:21: undefined reference to `_imp__curl_easy_setopt'
c:/Documents and Settings/Administrator/Desktop/bob/hello.cpp:22: undefined reference to `_imp__curl_easy_perform'
c:/Documents and Settings/Administrator/Desktop/bob/hello.cpp:25: undefined reference to `_imp__curl_easy_cleanup'
collect2: ld returned 1 exit status
mingw32-make[1]: *** [debug\bob.exe] Error 1
(i have put LIBS += -L"C:\Documents and Settings\Administrator\Desktop\curl\lib" -lcurl in my .pro file and include curl.h in my .cpp file. I also copied libcurl.dll and libeay32.dll into the release folder)
I feel i am missing something but.... dunno what.
later edit: i got it working with -lcurldll in .pro and with the .dlls in debug folder. but id still like to get it working the "other" way if possible.
Last edited by georgep; 23rd October 2008 at 03:25.
This should be enough.
It looks like there are some symbols missing. That "_imp" prefix suggests that you should use import library. Currently you link against libcurl.a, which is quite big, so it might be a static library. Try linking against libcurldll.a (-lcurldll).
georgep (23rd October 2008)
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?)
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:
QString stuffFromcURL; struct MemoryStruct chunk; chunk.memory=NULL; chunk.size = 0; //.... setting options and other stuff curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *)&chunk); //.... setting more optons //exec curl curl_easy_perform(curl_handle);To copy to clipboard, switch view to plain text mode
on pro file ....
i build curl on msys from mingwQt Code:
win32 { HEADERS += oswin32.h LIBS += C:/msys/1.0/bin/lib/libz.a LIBS += C:/msys/1.0/bin/lib/libcurl.dll.a LIBS += C:/msys/1.0/bin/lib/libcurl.a LIBS += ../all_os_lib/libexslt.a LIBS += ../all_os_lib/libxml2.a LIBS += ../all_os_lib/libxslt.a RC_FILE = win.rc INCLUDEPATH += C:\MinGW\include C:\msys\1.0\include C:\msys\1.0\home\xml\include DEPENDPATH += include DESTDIR = ../installer }To copy to clipboard, switch view to plain text mode
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)
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!
in my .pro file i just used
rather than
and BINGO! all compiles and works without errors![]()
Bookmarks