I've compiled the OpenSSL library using Mingw32 and MSys with Strawberry Perl. I used this forum post as a guide, even though it's quite old. How to build OpenSSL with MinGW in Windows?
Everything went fine, I wanted to compile it as a static library and it worked, but whenever I try to compile the library with my project using g++ I get the following errors, which I have no idea what they mean.
libcrypto.a(e_capi.o):e_capi.c:(.text+0xf1): undefined reference to `_imp__CertFreeCertificateContext@4'
libcrypto.a(e_capi.o):e_capi.c:(.text+0x191): undefined reference to `_imp__CertFreeCertificateContext@4'
libcrypto.a(e_capi.o):e_capi.c:(.text+0x5ed): undefined reference to `_imp__CertGetCertificateContextProperty@16'
libcrypto.a(e_capi.o):e_capi.c:(.text+0xbd3): undefined reference to `_imp__CertGetCertificateContextProperty@16'
libcrypto.a(e_capi.o):e_capi.c:(.text+0xd40): undefined reference to `_imp__CertEnumCertificatesInStore@8'
libcrypto.a(e_capi.o):e_capi.c:(.text+0xdd9): undefined reference to `_imp__CertFindCertificateInStore@24'
libcrypto.a(e_capi.o):e_capi.c:(.text+0x3012): undefined reference to `_imp__CertOpenStore@20'
libcrypto.a(e_capi.o):e_capi.c:(.text+0x3051): undefined reference to `_imp__CertEnumCertificatesInStore@8'
libcrypto.a(e_capi.o):e_capi.c:(.text+0x316f): undefined reference to `_imp__CertDuplicateCertificateContext@4'
libcrypto.a(e_capi.o):e_capi.c:(.text+0x31f1): undefined reference to `_imp__CertCloseStore@8'
libcrypto.a(e_capi.o):e_capi.c:(.text+0x32a5): undefined reference to `_imp__CertFreeCertificateContext@4'
libcrypto.a(e_capi.o):e_capi.c:(.text+0x396c): undefined reference to `_imp__CertOpenStore@20'
libcrypto.a(e_capi.o):e_capi.c:(.text+0x39ab): undefined reference to `_imp__CertFreeCertificateContext@4'
libcrypto.a(e_capi.o):e_capi.c:(.text+0x39c3): undefined reference to `_imp__CertCloseStore@8'
libcrypto.a(e_capi.o):e_capi.c:(.text+0x3a1f): undefined reference to `_imp__CertEnumCertificatesInStore@8'
libcrypto.a(e_capi.o):e_capi.c:(.text+0x4195): undefined reference to `_imp__CertOpenStore@20'
libcrypto.a(e_capi.o):e_capi.c:(.text+0x4208): undefined reference to `_imp__CertFreeCertificateContext@4'
libcrypto.a(e_capi.o):e_capi.c:(.text+0x4221): undefined reference to `_imp__CertCloseStore@8'
libcrypto.a(e_capi.o):e_capi.c:(.text+0x4359): undefined reference to `_imp__CertFreeCertificateContext@4'
libcrypto.a(e_capi.o):e_capi.c:(.text+0x440d): undefined reference to `_imp__CertFreeCertificateContext@4'
libcrypto.a(b_addr.o):b_addr.c:(.text+0xbe): undefined reference to `_imp__getnameinfo@28'
libcrypto.a(b_addr.o):b_addr.c:(.text+0xf4): undefined reference to `_imp__ntohs@4'
libcrypto.a(b_addr.o):b_addr.c:(.text+0x29a): undefined reference to `gai_strerrorW'
libcrypto.a(b_addr.o):b_addr.c:(.text+0x7c0): undefined reference to `_imp__freeaddrinfo@4'
libcrypto.a(b_addr.o):b_addr.c:(.text+0xae8): undefined reference to `_imp__getaddrinfo@16'
libcrypto.a(b_addr.o):b_addr.c:(.text+0xbc9): undefined reference to `gai_strerrorW'
libcrypto.a(b_addr.o):b_addr.c:(.text+0xcb3): undefined reference to `_imp__getaddrinfo@16'
libcrypto.a(b_addr.o):b_addr.c:(.text+0xd91): undefined reference to `gai_strerrorW'
libcrypto.a(b_sock.o):b_sock.c:(.text+0xdf): undefined reference to `_imp__WSAStartup@8'
libcrypto.a(b_sock.o):b_sock.c:(.text+0xf0): undefined reference to `_imp__WSAGetLastError@0'
libcrypto.a(b_sock.o):b_sock.c:(.text+0x2c7): undefined reference to `_imp__WSAStartup@8'
libcrypto.a(b_sock.o):b_sock.c:(.text+0x2d8): undefined reference to `_imp__WSAGetLastError@0'
libcrypto.a(b_sock.o):b_sock.c:(.text+0x3c1): undefined reference to `_imp__ntohs@4'
libcrypto.a(b_sock.o):b_sock.c:(.text+0x41c): undefined reference to `_imp__getsockopt@20'
libcrypto.a(b_sock.o):b_sock.c:(.text+0x43a): undefined reference to `_imp__WSAGetLastError@0'
libcrypto.a(b_sock.o):b_sock.c:(.text+0x45c): undefined reference to `_imp__gethostbyname@4'
libcrypto.a(b_sock.o):b_sock.c:(.text+0x4ab): undefined reference to `_imp__WSAStartup@8'
libcrypto.a(b_sock.o):b_sock.c:(.text+0x4c2): undefined reference to `_imp__WSAGetLastError@0'
libcrypto.a(b_sock.o):b_sock.c:(.text+0x54c): undefined reference to `_imp__WSACleanup@0'
libcrypto.a(b_sock.o):b_sock.c:(.text+0x56d): undefined reference to `_imp__ioctlsocket@12'
libcrypto.a(b_sock.o):b_sock.c:(.text+0x58a): undefined reference to `_imp__WSAGetLastError@0'
libcrypto.a(b_sock.o):b_sock.c:(.text+0x757): undefined reference to `_imp__WSAStartup@8'
libcrypto.a(b_sock.o):b_sock.c:(.text+0x768): undefined reference to `_imp__WSAGetLastError@0'
libcrypto.a(b_sock.o):b_sock.c:(.text+0x962): undefined reference to `_imp__WSAGetLastError@0'
libcrypto.a(b_sock.o):b_sock.c:(.text+0x9ec): undefined reference to `_imp__setsockopt@20'
libcrypto.a(b_sock.o):b_sock.c:(.text+0xa25): undefined reference to `_imp__ioctlsocket@12'
libcrypto.a(b_sock.o):b_sock.c:(.text+0xa42): undefined reference to `_imp__WSAGetLastError@0'
libcrypto.a(b_sock.o):b_sock.c:(.text+0xab6): undefined reference to `_imp__getsockname@12'
libcrypto.a(b_sock.o):b_sock.c:(.text+0xb1a): undefined reference to `_imp__WSAGetLastError@0'
libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x27): undefined reference to `_imp__socket@12'
libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x49): undefined reference to `_imp__WSAGetLastError@0'
libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x11c): undefined reference to `_imp__setsockopt@20'
libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x157): undefined reference to `_imp__connect@12'
libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x195): undefined reference to `_imp__setsockopt@20'
libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x1a6): undefined reference to `_imp__WSAGetLastError@0'
libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x264): undefined reference to `_imp__WSAGetLastError@0'
libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x2ca): undefined reference to `_imp__WSAGetLastError@0'
libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x362): undefined reference to `_imp__bind@12'
libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x3ba): undefined reference to `_imp__WSAGetLastError@0'
libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x467): undefined reference to `_imp__getsockopt@20'
libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x47d): undefined reference to `_imp__WSAGetLastError@0'
libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x531): undefined reference to `_imp__setsockopt@20'
libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x5dd): undefined reference to `_imp__listen@8'
libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x5eb): undefined reference to `_imp__WSAGetLastError@0'
libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x675): undefined reference to `_imp__setsockopt@20'
libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x686): undefined reference to `_imp__WSAGetLastError@0'
libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x71a): undefined reference to `_imp__setsockopt@20'
libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x72b): undefined reference to `_imp__WSAGetLastError@0'
libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x792): undefined reference to `_imp__WSAGetLastError@0'
libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x826): undefined reference to `_imp__accept@12'
libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x867): undefined reference to `_imp__WSAGetLastError@0'
libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x8cb): undefined reference to `_imp__closesocket@4'
libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x8ec): undefined reference to `_imp__closesocket@4'
libcrypto.a(bss_sock.o):bss_sock.c:(.text+0x1b2): undefined reference to `_imp__WSASetLastError@4'
libcrypto.a(bss_sock.o):bss_sock.c:(.text+0x1d9): undefined reference to `_imp__send@16'
libcrypto.a(bss_sock.o):bss_sock.c:(.text+0x20a): undefined reference to `_imp__WSAGetLastError@0'
libcrypto.a(bss_sock.o):bss_sock.c:(.text+0x281): undefined reference to `_imp__WSASetLastError@4'
libcrypto.a(bss_sock.o):bss_sock.c:(.text+0x2a0): undefined reference to `_imp__send@16'
libcrypto.a(bss_sock.o):bss_sock.c:(.text+0x2da): undefined reference to `_imp__WSAGetLastError@0'
libcrypto.a(bss_sock.o):bss_sock.c:(.text+0x34d): undefined reference to `_imp__WSASetLastError@4'
libcrypto.a(bss_sock.o):bss_sock.c:(.text+0x370): undefined reference to `_imp__recv@16'
libcrypto.a(bss_sock.o):bss_sock.c:(.text+0x3c2): undefined reference to `_imp__WSAGetLastError@0'
libcrypto.a(bss_sock.o):bss_sock.c:(.text+0x482): undefined reference to `_imp__WSAGetLastError@0'
collect2.exe: error: ld returned 1 exit status
I'm using VSCode as a development environment, this is the build command for the project, extracted from tasks.json:
g++.exe file1.cpp file2.cpp main.cpp -L*folder with the library* -lcrypto -o test.exe