On 9/14/2022 4:48 AM, Coffee Bug via curl-library wrote:
#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.


You can resolve most of those with -lcrypt32, but I'm not sure why you see the sys_nerr and sys_errlist, that is odd. Try to compile this:

#include <stdlib.h>
#include <stdio.h>

int main(int argc, char *argv[])
{
  /* print from errlist such as "Illegal byte sequence" etc */
  printf("%s\n", _sys_errlist[_sys_nerr - 1]);
  return 0;
}

--
Unsubscribe: https://lists.haxx.se/listinfo/curl-library
Etiquette:   https://curl.se/mail/etiquette.html

Reply via email to