Error when trying to install Rmpfr in R related to the header file mpfr.h
You should install libmpfr-dev:
sudo apt-get install libmpfr-dev
(answer from the first, highly upvoted comment by @user3710546)
c++ program using GMP library
Get the actual version here GNU GMP Library. Make sure you configure it to be installed in /usr/lib (pass --prefix=/usr to configure).
Here you have documentation: GNU GMP Manual.
You are not using the lib correctly. I don't know if you can directly access mpx values
with C++ functions but, here you have a working example of what you wanted to achieve:
#include<iostream>
#include<gmp.h>
using namespace std;
int main (int argc, char **argv) {
mpz_t a,b,c;
mpz_inits(a,b,c,NULL);
mpz_set_str(a, "1234", 10);
mpz_set_str(b,"-5678", 10); //Decimal base
mpz_add(c,a,b);
cout<<"\nThe exact result is:";
mpz_out_str(stdout, 10, c); //Stream, numerical base, var
cout<<endl;
mpz_abs(c, c);
cout<<"The absolute value result is:";
mpz_out_str(stdout, 10, c);
cout<<endl;
cin.get();
return 0;
}
Compile with:
g++ -lgmp file.cpp -o file
Related Topics
How to Capitalize First Letter of Each Line in Bash
How Do Programs Communicate with Each Other
Gdb Warning: Loadable Section Not Found in Added Symbol-File System-Supplied Dso at 0X7Ffff7Ffd000
Split Delimited File into Smaller Files by Column
How to Remove the Last Character of the Last Line of a File
Bash Scripting - Iterating Through "Variable" Variable Names for a List of Associative Arrays
How to Execute Multiple Commands After Sudo Command
X86 Gnu Assembler Strange Change Seg Fault
Access Denied to Android.Git.Kernel.Org
Shell Script for Process Monitoring
What Do the Suffixes "+" and "-" After the Job Id of Background Jobs Mean
Rsync --Exclude Not Excluding Specific Files
Best Text Search Engine for Integrating with Custom Web App
Running Multiple Compass-Sass Watch Operations Automatically
Npm Install Causes Errors Like Npm Err! Tar.Unpack Untar Error on Debian
What Does Grep -Po '...\K...' Do? How Else Can That Effect Be Achieved
Fatal: Git Was Built Without Support for Git-Add--Interactive (No_Perl=1)