curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Requesting Help on libcurl compile

From: Coffee Bug via curl-library <curl-library_at_lists.haxx.se>
Date: Wed, 14 Sep 2022 16:48:12 +0800

I am presently trying to learn libcurl in c++. However, I am not able to
successfully compile.

In compiling just the following:

#include <curl/curl.h>
int main() {
  curl_global_init(CURL_GLOBAL_DEFAULT);
}

I already encounter the following errors:

libs\curl_new64\lib\libcurl.a(strerror.o):strerror.c|| undefined reference
to `__imp___sys_nerr'|
libs\curl_new64\lib\libcurl.a(strerror.o):strerror.c|| undefined reference
to `__imp___sys_errlist'|
libs\curl_new64\lib\libcurl.a(openssl.o):openssl.c|| undefined reference to
`__imp_CertOpenSystemStoreA'|
libs\curl_new64\lib\libcurl.a(openssl.o):openssl.c|| undefined reference to
`__imp_CertEnumCertificatesInStore'|
libs\curl_new64\lib\libcurl.a(openssl.o):openssl.c|| undefined reference to
`__imp_CertEnumCertificatesInStore'|
libs\curl_new64\lib\libcurl.a(openssl.o):openssl.c|| undefined reference to
`__imp_CertGetIntendedKeyUsage'|
libs\curl_new64\lib\libcurl.a(openssl.o):openssl.c|| undefined reference to
`__imp_CertGetEnhancedKeyUsage'|
libs\curl_new64\lib\libcurl.a(openssl.o):openssl.c|| undefined reference to
`__imp_CertGetEnhancedKeyUsage'|
libs\curl_new64\lib\libcurl.a(openssl.o):openssl.c|| undefined reference to
`__imp_CertFreeCertificateContext'|
libs\curl_new64\lib\libcurl.a(openssl.o):openssl.c|| undefined reference to
`__imp_CertCloseStore'|
libs\curl_new64\lib\libcurl.a(schannel.o):schannel.c|| undefined reference
to `__imp_CertFreeCertificateContext'|
libs\curl_new64\lib\libcurl.a(schannel.o):schannel.c|| undefined reference
to `__imp_PFXImportCertStore'|
libs\curl_new64\lib\libcurl.a(schannel.o):schannel.c|| undefined reference
to `__imp_CertFindCertificateInStore'|
libs\curl_new64\lib\libcurl.a(schannel.o):schannel.c|| undefined reference
to `__imp_CertCloseStore'|
libs\curl_new64\lib\libcurl.a(schannel.o):schannel.c|| undefined reference
to `__imp_CertFreeCertificateContext'|
libs\curl_new64\lib\libcurl.a(schannel.o):schannel.c|| undefined reference
to `__imp_CertCloseStore'|
libs\curl_new64\lib\libcurl.a(schannel.o):schannel.c|| undefined reference
to `__imp_CertEnumCertificatesInStore'|
libs\curl_new64\lib\libcurl.a(schannel.o):schannel.c|| undefined reference
to `__imp_CertEnumCertificatesInStore'|
libs\curl_new64\lib\libcurl.a(schannel.o):schannel.c|| undefined reference
to `__imp_CertFreeCertificateContext'|
libs\curl_new64\lib\libcurl.a(schannel.o):schannel.c|| undefined reference
to `__imp_CertFreeCertificateContext'|
libs\curl_new64\lib\libcurl.a(schannel.o):schannel.c|| undefined reference
to `__imp_CertFreeCertificateContext'|
libs\curl_new64\lib\libcurl.a(schannel.o):schannel.c|| undefined reference
to `__imp_CertOpenStore'|
libs\curl_new64\lib\libcurl.a(schannel.o):schannel.c|| undefined reference
to `__imp_CryptStringToBinaryA'|
libs\curl_new64\lib\libcurl.a(schannel.o):schannel.c|| undefined reference
to `__imp_CertFindCertificateInStore'|
libs\curl_new64\lib\libcurl.a(schannel.o):schannel.c|| undefined reference
to `__imp_CertEnumCertificatesInStore'|
libs\curl_new64\lib\libcurl.a(schannel.o):schannel.c|| undefined reference
to `__imp_CertFreeCertificateContext'|
libs\curl_new64\lib\libcurl.a(schannel_verify.o):schannel_verify.c||
undefined reference to `__imp_CertOpenStore'|
libs\curl_new64\lib\libcurl.a(schannel_verify.o):schannel_verify.c||
undefined reference to `__imp_CertGetCertificateChain'|
libs\curl_new64\lib\libcurl.a(schannel_verify.o):schannel_verify.c||
undefined reference to `__imp_CertFreeCertificateChainEngine'|
libs\curl_new64\lib\libcurl.a(schannel_verify.o):schannel_verify.c||
undefined reference to `__imp_CertCloseStore'|
libs\curl_new64\lib\libcurl.a(schannel_verify.o):schannel_verify.c||
undefined reference to `__imp_CertFreeCertificateChain'|
libs\curl_new64\lib\libcurl.a(schannel_verify.o):schannel_verify.c||
undefined reference to `__imp_CertFreeCertificateContext'|
libs\curl_new64\lib\libcurl.a(schannel_verify.o):schannel_verify.c||
undefined reference to `__imp_CertCreateCertificateChainEngine'|
libs\curl_new64\lib\libcurl.a(schannel_verify.o):schannel_verify.c||
undefined reference to `__imp_CryptQueryObject'|
libs\curl_new64\lib\libcurl.a(schannel_verify.o):schannel_verify.c||
undefined reference to `__imp_CertAddCertificateContextToStore'|
libs\curl_new64\lib\libcurl.a(schannel_verify.o):schannel_verify.c||
undefined reference to `__imp_CertFreeCertificateContext'|
libs\curl_new64\lib\libcurl.a(schannel_verify.o):schannel_verify.c||
undefined reference to `__imp_CertGetNameStringA'|
libs\curl_new64\lib\libcurl.a(schannel_verify.o):schannel_verify.c||
undefined reference to `__imp_CertFindExtension'|
libs\curl_new64\lib\libcurl.a(schannel_verify.o):schannel_verify.c||
undefined reference to `__imp_CryptDecodeObjectEx'|
||error: ld returned 1 exit status|
||=== Build failed: 40 error(s), 4 warning(s) (0 minute(s), 2 second(s))
===|

I use the following software versions:
 - mingw-w64: downloaded and installed thru msys2
 - libcurl: 7.85.0
 - ide: codeblocks

I have included in the compiler setup:
  CURL_STATICLIB

And have setup the linker options with:
  -s -static -Wl,--add-stdcall-alias

I have also added libraries (in the following order):
  -loleaut32 -luser32 -lcurl -lnghttp2 -lidn2 -lngtcp2
-lngtcp2_crypto_openssl -lnghttp3 -lssl -lssh2 -lcrypto -lz -lwldap32
-lws2_32 -lwinmm -lgdi32 -lbcrypt -lbrotlidec -lbrotlicommon -lzstd -lgsasl

I would appreciate any instructions on how I should proceed. I suspect I
might have not ordered the linking of libraries correctly? Thank you.


-- 
Unsubscribe: https://lists.haxx.se/listinfo/curl-library
Etiquette:   https://curl.se/mail/etiquette.html
Received on 2022-09-14