Headers and variables have been set
file.cpp
Need help
Solved by manually creating a symbolic link
/opt/lib/libgmp.so -> /opt/lib/libgmp.so.10
Using GCC for native compilation
Ultimate repo for embedded devices. Contribute to Entware/Entware development by creating an account on GitHub.
github.com
file.cpp
Code:
#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;
}
Code:
opkg install libgmp
Package libgmp (6.2.1-1a) installed in root is up to date.
# find /opt/lib -name libgmp.so*
/opt/lib/libgmp.so.10.4.1
/opt/lib/libgmp.so.10
# g++ -lgmp file.cpp -o file
/opt/bin/ld: cannot find -lgmp: No such file or directory
collect2: error: ld returned 1 exit status
Need help
Solved by manually creating a symbolic link
/opt/lib/libgmp.so -> /opt/lib/libgmp.so.10
Last edited: