Solved Include curl statically to Qt project
-
hi i trying to include curl to my project (static)
but no matter how i try.. i get the same error everytime
i test precompiled curl its make the program crash at start
so i build it from source (with mingw) and also include openssl to it ( i use this command to buildconfigure --disable-shared --without-zlib --without-libidn --without-librtmp --disable-ldap —-with-ssl=<path where my openssl is installed>
but when i add new lib to my project its still give me above error
anyone can show me a way to do this job?
(or maybe show me a better way then curl) -
Hi,
Did you try to run your application in debug mode with the pre-built binary ?
Are you sure your custom build uses the same architecture as your Qt version ?
-
@SGaist i use qt mingw to build my custom build
-
@SGaist and also i can run application in debug mode becuse its doesn't even run
-
@saeid0034 said in Include curl statically to Qt project:
or maybe show me a better way then curl
I think the better way is to use Qt Network module instead of curl if possible.
What do you need curl for? -
@Bonnie i only want to send some https request to my site and get respond
can you show me some example of using Qnetwork -
@saeid0034
You should looke at QNetworkAccessManager Class and HTTP Example.
The example usesget
method, you should change topost
.
Also the post response data is normally not much, so you can skip thereadyRead
part and read all the data inhttpFinished
slot.Ah, I forgot to mention that Qt will try to load openssl dynamically to connect https.
So you need to have openssl dynamic library binaries installed to your system or with your executable file. -
@Bonnie thanks for reply
its give me this errorqt.network.ssl: QSslSocket::connectToHostEncrypted: TLS initialization failed
i build qt static and forgot to add -openssl-linked to build option
there is anyway for me to use it static now? -
@saeid0034
Well, surely you cannot use the static libraries without rebuild the static qt bacause the qt module needs it...
But maybe you can load the dynamic libraries? I'm not sure about that... -
@Bonnie build static qt on windows was a pain 😅
i think its better for me use dynamic curl with openssl or winssl -
anyone can help me to how use openssl in a project without need to build qt with openssl?
i think its beter to create new topic and ask this