问题
I've managed to to use mpfr-mpir-gmp in CodeBlocks but I want to in eclipse C++:
When I compile the code it compiles and build but if I run the project it says: "error while loading shared libraries: libmpfr.so.6: cannot open shared object file: No such file or directory".
So can anyone show me how to configure eclipse to use gmp-mpifr-mpir correctly?
If I compile from a terminal:
g++ -lmpir -lmpfr -lgmp myEclpiseMPFRMPIRproj.cpp
then :
./a.out
It works fine and doesn't complain about the same problem. So I think I don't know how to pass those flags -lgmp, -lmpir -lmpfr
.
Thank you.
回答1:
I've figured it out after thousands of attempts without giving up. I am happy to share it for someone who may face the same problem:
When I've built and installed "gmp, mpfr, mpir" I've used sudo make install
so the library is in /usr/local
thus when I create a project with Eclipse-CDT everything is there only I add the flag to the linker:
Project->properties->C/C++ Build->Settings->GCC C++ Linker->Command and add:
g++ -lgmp -lmpir -lmpfr
- Apply and Close. Now build and run. It works fine!
N.B: The problems I've faced already because I've add the library paths and files
and include paths
so I've removed them all.
来源:https://stackoverflow.com/questions/60950890/how-to-use-gmp-mpir-mpfr-in-eclipse-correctly