PDA

View Full Version : How to use GMP with Qt creator 5 (latest version) on Windows?



lehuyduc
10th February 2020, 15:24
So I have downloaded the latest version of Qt Creator (5.something...) using the online Qt Downloader, and GMP version 6.2.0

But I can't find any tutorials on how to use GMP library at all. And if I do, it's on Mac/Linux, which I can't use.

So, how can I write a "Hello world" program using GMP in Qt Creator? A program that calculates 10000!, or e^1000 to 10^4 decimal places, for example.

Thank you for reading.

Edit: actually I don't need to use GMP, any high-precision float library is okay. What should I use in Qt? Thank you.

d_stranz
10th February 2020, 16:42
Please do not double-post. Everyone who reads this forum will see your post whether you put it in the Qt Programming or Newbie sections. Don't put it in both places.

In order to use any GNU libraries on Windows, you will probably have to also install and use the MinGW toolchain with the g++ compiler. Qt Creator can work with any toolchain - you will have to read the Qt Creator documentation regarding configuring a "kit" to use it.

You will also have to install (or build from source code) a Qt distribution that was also built using the MinGW toolchain. You cannot mix and match libraries and DLLs built using g++ and Microsoft's VC++ compilers.

If this seems like a lot of work, it is. You might be better off trying to find an MP library built for Windows or a GMP distribution built using your compiler. Google is probably your friend here.

lehuyduc
11th February 2020, 02:43
Please do not double-post. Everyone who reads this forum will see your post whether you put it in the Qt Programming or Newbie sections. Don't put it in both places.

In order to use any GNU libraries on Windows, you will probably have to also install and use the MinGW toolchain with the g++ compiler. Qt Creator can work with any toolchain - you will have to read the Qt Creator documentation regarding configuring a "kit" to use it.

You will also have to install (or build from source code) a Qt distribution that was also built using the MinGW toolchain. You cannot mix and match libraries and DLLs built using g++ and Microsoft's VC++ compilers.

If this seems like a lot of work, it is. You might be better off trying to find an MP library built for Windows or a GMP distribution built using your compiler. Google is probably your friend here.

Thank you. It seems there's no easy way to do it on windows. I will try mingw tool.

ChrisW67
11th February 2020, 08:51
You might find that MPIR (http://www.mpir.org/index.html) can be built on Windows with MSVC if that is the compiler you have