trying to add GMP library, need to link "libgmpxx and libgmp" to compiler

hello. i’m in way over my head here. familiar with programming in general, and have delved into enough UE4 C++ tutorials to get a bit of an idea. i’ve managed to create my own simple but unique blueprint nodes.

i’m trying to add the GNU Multiple Precision Arithmetic Library, to work with BigNum in my game.

link one, the interface guidelines

link two, a solid looking bit of info from stackexchange that might help me get this going.

following link one, i tried adding just #include gmpxx.h to the header file in a blank BluePrintFunctionLibrary. this throws a very long list of errors saying “Unable to merge actions [name].c.obj: prerequisites are different”. the only search results talked about deleting duplicate files. there are indeed duplicate filenames, but in different subfolders. for example:


mpz/abs.c // mpz_abs(dst, src) -- Assign the absolute value of SRC to DST.
mpf/abs.c // mpf_abs -- Compute the absolute value of a float.
mpq/abs.c // mpq_abs -- absolute value of a rational.

but the interface guideline also says

i cannot find either of those libraries in my gmp folder. this led me to link two, where they have working code samples using g++ or clang++ on linux, and stress the importance of the -link tags

for that i went back to the VS Installer and made sure i had the desktop C++ workflow, and manually added the two Clang++ options as well.

i learned WHERE i can do this linking for the project, (right click the project name, select properties, VC++ Directories, ->Library Directories) but i’m officially lost at this point. i tried adding the whole gmp folder, tried just adding the mpz/mpq/mpf folders, none of it seems to works. my next step i can think of is to try and get Visual Studio to use the Clang++ compiler for me, but i don’t know if this will have an impact on the Unreal macros.

VS2019 16.8.4

bump.

mods i’m sorry if this is against the rules, but i worked incredibly hard to get to this point, and it’s the issue that derailed my previous attempt at making a full fledged game (edit: with my buddy who spent hundreds of hours on the 3d modelling…), so i’m starting here first. i spent almost 2 hours just writing this post haha.

halp.

UE4 has it’s special way of linking libraries (if copying sources and headers is not possible):

Even though, UE4 on linux uses clang, I think it’s feasible to use MSVC on windows. Look at other guy who tried to use clang: Using Clang to compile on Windows - Engine Source & GitHub - Unreal Engine Forums

If your library doesn’t work with windows, consider using similar one (MPIR?). If you just need BigInt, there is millions of alternatives, I think

thank you for the resources i will look into that.

yes my only reason for picking this library was basically popularity and how complete it looks. and probably because i’m spoiled by UE thinking my compiler can just target whatever platform i want o.o