I'm working using Visual Studio 2019. I have a project that requires GMP and MPFR ; as far as I know, there are no recent binaries available for Windows and one has to build his own.
To build GMP/MPFR from source code, I used the mingw-w64-x86_64-toolchain
installed with the command pacman -S mingw-w64-x86_64-toolchain
in MSYS2 shell. Then, from the MinGW64 shell, I just used ./configure, make, make install
and ended up with .a libraries, which is, unless I'm wrong, perfectly usable in a VS project.
So now back to my project in Visual Studio, I'm trying to compile it with default compiler CL => it fails with the following errors :
Severity Code Description Project File Line Suppression State
Error LNK1120 2 unresolved externals MyProject MyProject.exe 1
Error LNK2001 unresolved external symbol ___chkstk_ms MyProject libgmp.a(aors.o) 1
Error LNK2001 unresolved external symbol ___chkstk_ms MyProject libgmp.a(dcpi1_bdiv_q.o) 1
Error LNK2001 unresolved external symbol ___chkstk_ms MyProject libgmp.a(dcpi1_bdiv_qr.o) 1
Error LNK2019 unresolved external symbol ___chkstk_ms referenced in function mpn_dcpi1_divappr_q_n MyProject libgmp.a(dcpi1_divappr_q.o) 1
Error LNK2001 unresolved external symbol ___chkstk_ms MyProject libgmp.a(dcpi1_div_qr.o) 1
Error LNK2001 unresolved external symbol ___chkstk_ms MyProject libgmp.a(divexact.o) 1
Error LNK2001 unresolved external symbol ___chkstk_ms MyProject libgmp.a(gcd.o) 1
Error LNK2001 unresolved external symbol ___chkstk_ms MyProject libgmp.a(hgcd_reduce.o) 1
Error LNK2001 unresolved external symbol ___chkstk_ms MyProject libgmp.a(invertappr.o) 1
Error LNK2001 unresolved external symbol ___chkstk_ms MyProject libgmp.a(lt103-divexact.o) 1
Error LNK2001 unresolved external symbol ___chkstk_ms MyProject libgmp.a(lt31-mul.o) 1
Error LNK2001 unresolved external symbol ___chkstk_ms MyProject libgmp.a(lt55-cmp.o) 1
Error LNK2001 unresolved external symbol ___chkstk_ms MyProject libgmp.a(lt57-cmp_ui.o) 1
Error LNK2001 unresolved external symbol ___chkstk_ms MyProject libgmp.a(lt64-mul.o) 1
Error LNK2001 unresolved external symbol ___chkstk_ms MyProject libgmp.a(lt82-mul.o) 1
Error LNK2001 unresolved external symbol ___chkstk_ms MyProject libgmp.a(lt97-gcd.o) 1
Error LNK2001 unresolved external symbol ___chkstk_ms MyProject libgmp.a(lt99-tdiv_qr.o) 1
Error LNK2001 unresolved external symbol ___chkstk_ms MyProject libgmp.a(mullo_n.o) 1
Error LNK2001 unresolved external symbol ___chkstk_ms MyProject libgmp.a(mul_n.o) 1
Error LNK2001 unresolved external symbol ___chkstk_ms MyProject libgmp.a(nussbaumer_mul.o) 1
Error LNK2001 unresolved external symbol ___chkstk_ms MyProject libgmp.a(sqr.o) 1
Error LNK2001 unresolved external symbol ___chkstk_ms MyProject libgmp.a(toom42_mul.o) 1
Error LNK2001 unresolved external symbol ___chkstk_ms MyProject libgmp.a(toom53_mul.o) 1
Error LNK2019 unresolved external symbol __mingw_raise_matherr referenced in function cos MyProject libmingwex.a(lib64_libmingwex_a-cos.o) 1
Error LNK2001 unresolved external symbol ___chkstk_ms MyProject libmingwex.a(lib64_libmingwex_a-mingw_pformat.o) 1
Error LNK2001 unresolved external symbol __mingw_raise_matherr MyProject libmingwex.a(lib64_libmingwex_a-sin.o) 1
Error LNK2001 unresolved external symbol __mingw_raise_matherr MyProject libmingwex.a(lib64_libmingwex_a-sqrt.o) 1
I imagine that I need to link my VS project with a static-library from MSYS2 but I canno't figure which one. Following this topic I already linked with C:\msys64\mingw64\x86_64-w64-mingw32\lib\libmingwex.a but now I'm quite stuck. Any suggestion?