gmpxx.h:没有这样的文件或目录
我刚刚安装了一个全新的 mingw 副本(32 位),从 Sourceforge 的官方项目页面下载它。我安装了包中的所有内容,所有编译器等等。然后我从 这里 下载 MinGW 的 gmp 。我将 gmp-5.0.1-1-mingw32-src.tar.lzma 提取到我的 mingw 文件夹中,然后从那里运行 ./pkgbuild
。它继续运行了几分钟,然后打印出类似 COMPLETED EVERYTHING OK, EVERYTHING PASS
的内容。
然后我写下了这个简单的示例,以检查它是否能够工作:
#include <gmpxx.h>
int main (void)
{
mpz_class a, b, c;
a = 1234;
b = "-5678";
c = a+b;
cout << "sum is " << c << "\n";
cout << "absolute value is " << abs(c) << "\n";
return 0;
}
然后使用 g++ mycxxprog.cc -lgmpxx -lgmp
编译它。 我得到的唯一答案是:
Fatal error: gmpxx.h: No such file or directory.
有人有任何提示吗?我真的不知道我该怎么办...
I just installed a brand new copy of mingw (32 bit) downloading it from the official project page from Sourceforge. I installed everything in the package, all compilers and so on. Then I downloaded from here gmp for MinGW. I extracted gmp-5.0.1-1-mingw32-src.tar.lzma somewhere into my mingw folder, then ran ./pkgbuild
from there. It went on running for some minutes, then printed out something like COMPLETED EVERYTHING OK, EVERYTHING PASS
.
Then I wrote down this simple example, to check if it was going to work:
#include <gmpxx.h>
int main (void)
{
mpz_class a, b, c;
a = 1234;
b = "-5678";
c = a+b;
cout << "sum is " << c << "\n";
cout << "absolute value is " << abs(c) << "\n";
return 0;
}
And then compiled it using g++ mycxxprog.cc -lgmpxx -lgmp
.
The only answer I get is:
Fatal error: gmpxx.h: No such file or directory.
Does anybody have any hint? I don't really know what should I do...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
gmpxx.h
头文件包含在libgmp-dev
包中您可以使用以下命令将其安装在基于 Ubuntu 的计算机上:
gmpxx.h
header file is included in thelibgmp-dev
packageYou can install it on Ubuntu based machines with this command:
如果您从源代码构建 gmp,则需要将 --enable-cxx 标志添加到配置命令中。
If you are building gmp from source, you need to add the --enable-cxx flag to the configure command.
您也可以将其复制到路径“/usr/include/”,系统会找到它。
You can also copy that to the path"/usr/include/", the system will find it.
您需要确保它位于搜索标头的目录中。找到
gmpxx.h
标头所在的位置,并在g++
行添加-I /path/to/header/
。You need to make sure the is among the directories searched for headers. Find the place where the
gmpxx.h
header resides and add-I /path/to/header/
on yourg++
line.