如何正确使用eclipse中的gmp-mpir-mpfr? [英] How to use gmp-mpir-mpfr in eclipse correctly?
问题描述
我设法在CodeBlocks中使用mpfr-mpir-gmp,但我想在Eclipse C ++中使用:
I've managed to to use mpfr-mpir-gmp in CodeBlocks but I want to in eclipse C++:
当我编译代码时,它会编译并生成,如果我运行项目,它会说:加载共享库时出错:libmpfr.so.6:无法打开共享库文件:没有这样的文件或目录。
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".
所以谁能告诉我如何配置eclipse以正确使用gmp-mpifr-mpir?
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
然后:
./a.out
它可以正常工作,并且不会抱怨相同的问题。所以我想我不知道如何传递那些标志 -lgmp,-lmpir -lmpfr
。
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
.
谢谢您。
推荐答案
我已经尝试了数千次,但并没有放弃。我很高兴将其分享给可能会遇到相同问题的人:
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:
当我构建并安装了 gmp,mpfr,mpir后,我就使用了 sudo make install
,所以该库位于 / usr / local
中,因此当我使用Eclipse-CDT创建项目时,仅存在所有内容我将标志添加到链接器中:
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
- 应用并关闭。现在构建并运行。
注意:我已经遇到的问题是因为我添加了库路径和文件
和包含路径
,因此我将其全部删除。
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.
这篇关于如何正确使用eclipse中的gmp-mpir-mpfr?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!