I've been working on a C++ project. I have been using 2 Windows PCs for building it and both worked fine with the same (kinda janky) setup. I recently got a new computer and I get a linker error. My build process uses prebuilt .a files for the dependencies I am using. Differences: new laptop is Windows 11 and not Windows 10 and compiler version might be a bit newer. However, I don't think this can explain it.
The error I get is:
C:/ProgramData/mingw64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/15.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: include_windows/openssl/lib\libcrypto.a(libcrypto-lib-cryptlib.obj):cryptlib.c:(.text+0x536): undefined reference to `__imp__vsnprintf'
My build command in the make file has:
CXXFLAGS = -std=c++17 -Wall -O3 -I include -I include_windows -I src
LDFLAGS = -static -static-libgcc -static-libstdc++ -L include_windows/GLFW/lib -L include_windows/openssl/lib -lglfw3 -lopengl32 -lglu32 -lgdi32 -lssl -lcrypto -lcrypt32 -lws2_32 -lwsock32
__imp__this Microsoft behavior is to link to an import library however gcc / g++ can link to dll or dll.a unlike Microsoft's compiler that needs a .lib for the import library in native c++undefined reference to __imp__vsnprintf-- My build process uses prebuilt .a files -- You need to know exactly what options a static library was built with before attempting to use it. These details should have been noted at whatever site you obtained the library (otherwise that is a fail by the provider by the library). Obviously the one you chose was built assuming that any calls made to the C++ standard library will be made to the dll version of the standarad library.