In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
How to use GMP library under Window, for this problem, this article introduces the corresponding analysis and answer in detail, hoping to help more partners who want to solve this problem to find a more simple and easy way.
GMP introduction
GMP is The GNU MP Bignum Library, an open source mathematical operation library, which can be used for any precision of mathematical operations, including signed integers, rational numbers and floating-point numbers. It has no precision limit itself, it only depends on the hardware condition of the machine. For more details, please visit the official website https://gmplib.org/.
Software required by the environment
MinGW
Pexports
Click on the above two software names to download the corresponding installation package. If you can't download it, you can download it from my network disk at the following address: link: http://pan.baidu.com/s/1slw4YOP password: 9a2h
-here is the time division line.-if you are in a hurry, I also have a compiled .h. Lib. DLL file on my network disk, which can be downloaded directly. Of course, after you download it here, you don't have to read the following, the address is as follows: link: http://pan.baidu.com/s/1bpaCP0z password: kaxw
Installation process
1. After installing MinGW, choose "mingw32-base", "mingw32-gcc-g++", "mingw32-gmp" to install components. You need to keep the network connection normal during the installation of components. This article assumes that the installation path of MinGW is the default path C:\ MinGW
two。 Install pexports and copy the downloaded pexports.exe into C:\ MinGW\ bin
3. When it comes to generating lib files, GMP is already installed in Windows. We just need to load the gmp.h and libgmp.lib files into our VS project to use the GMP library. If gmp.h is located in C:\ MinGW\ include directory, libgmp.lib needs to be generated manually. We can generate the corresponding lib file according to C:\ MinGW\ bin\ libgmp-10.dll, as follows:
Cd C:\ MinGW\ binpexports.exe libgmp-10.dll > libgmp-10.deflib / def:libgmp-10.def
At this point, the libgmp.lib file appears in the directory.
If you prompt that the lib command does not exist, write the relevant path to VS to the environment variable, for example, mine is C:\ Program Files (x86)\ Microsoft Visual Studio 10.0\ VC\ bin
Use the example
Here I'll take VS2010 as an example. first, we need to load the gmp.h and libgmp.lib files into the project. The code is as follows:
# include "gmp.h" # pragma comment (lib, "libgmp-10.lib") int main () {mpz_t t; / / mpz_t is GMP built-in large number type mpz_init (t); / / large number t should be initialized before use to dynamically allocate space mpz_ui_pow_ui (t, 2,100) / / GMP all functions basically start with mpz gmp_printf ("2 ^ 100 =% Zd\ n", t); / / output large numbers, which are formatted with% Zd mpz_clear (t); scanf_s ("% s"); return 0 } this is the answer to the question on how to use the GMP library under Window. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel for more related knowledge.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.