C++ 缺少 libgmp-10.dll

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6951938/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-28 21:00:20  来源:igfitidea点击:

libgmp-10.dll is missing

c++windowswindows-7mingw

提问by neofu50

I recently installed MinGW on my 64-bit Windows 7 computer and when I attempt to compile the most basic of c++ programs, for example

我最近在我的 64 位 Windows 7 计算机上安装了 MinGW,当我尝试编译最基本的 C++ 程序时,例如

#include<iostream>

using namespace std;

int main()
{
    cout << "Hello World" << endl;
    return 0;
}

I get the error that "The program can't start because libgmp-10.dll is missing from your computer."

我收到错误消息“程序无法启动,因为您的计算机缺少 libgmp-10.dll。”

回答by Lucian

Have you tried adding C:\MinGW\binas a System variable Path(not PATH) in Settings->System Properties->Environment Variables?

您是否尝试在 中添加C:\MinGW\bin为系统变量Path(不是PATHSettings->System Properties->Environment Variables

I saw this solution on this page: Missing libgmp-10.dll

我在这个页面上看到了这个解决方案:Missing libgmp-10.dll

回答by Jarekczek

Go to the mingw download pageand browse the following directories:

转到mingw 下载页面并浏览以下目录:

MinGW / Base / gmp / gmp-5.0.1-1

MinGW / Base / gmp / gmp-5.0.1-1

Currently you end up with the following link:
http://sourceforge.net/projects/mingw/files/MinGW/Base/gmp/gmp-5.0.1-1/libgmp-5.0.1-1-mingw32-dll-10.tar.lzma/download
and it contains the needed file.

目前你最终得到以下链接:
http: //sourceforge.net/projects/mingw/files/MinGW/Base/gmp/gmp-5.0.1-1/libgmp-5.0.1-1-mingw32-dl​​l-10 .tar.lzma/download
并且它包含所需的文件。

I know there are automated methods for installing mingw gcc, but when one uses single mingw packages, then gmpis one of obligatory downloads.

我知道有安装 mingw gcc 的自动化方法,但是当使用单个 mingw 软件包时,则gmp是必须下载的方法之一。

回答by santosh

added

添加

c:/MinGW/bin to PATH

c:/MinGW/bin 到 PATH

and restarted CMake-gui

并重新启动 CMake-gui

worked for me

为我工作

回答by formerBGIuser

I came upon this question when I started CodeBlocks and then clicked on my project. After the project notes appeared and I pressed OK, the error appeared:

当我启动 CodeBlocks 然后单击我的项目时,我遇到了这个问题。项目注释出现后我按OK,出现错误:

"System Error: The program can't start because libgmp-10.dll is missing from your computer. Please reinstall the application to fix this problem."

“系统错误:程序无法启动,因为您的计算机缺少 libgmp-10.dll。请重新安装应用程序以解决此问题。”

I presse OK a bunch of times and then was able to do normal compile, link, etc. but that error showed up everytime I started C::B and went to the project. Then I noticed that the LLVM Clang compiler was my default compiler in the compiler settings, though GCC was set as the compiler specific to the project I was working on.

我多次按下 OK,然后能够进行正常的编译、链接等。但是每次我启动 C::B 并进入项目时都会出现该错误。然后我注意到 LLVM Clang 编译器是我在编译器设置中的默认编译器,尽管 GCC 被设置为特定于我正在处理的项目的编译器。

The solution was to set the compiler in the compiler settings to GCC (mingw) and also set it as the default compiler. After that this system error stopped popping up every time I started the project.

解决方案是在编译器设置中将编译器设置为 GCC (mingw) 并将其设置为默认编译器。之后,每次启动项目时,此系统错误都不再出现。

The reason I posted this answer is because it answers the OP's question and other people with the same question may have a similar reason for this irritation, and my personal experience in this matter may prove useful to those people.

我发布这个答案的原因是因为它回答了 OP 的问题,而其他有相同问题的人可能也有类似的原因,而我在这件事上的个人经验可能对这些人有用。

回答by Tarrex

If you did not find this file in your installation directory, and then went to the site [Click here] to download the file, and then extract it to your installation directory.enjoy:-)

如果你在你的安装目录下没有找到这个文件,那就去网站【点击这里】下载这个文件,然后解压到你的安装目录下。enjoy:-)

回答by sage

Caution - removing stuff from your path can compromise your system!

注意 - 从您的路径中删除内容可能会危及您的系统!

Interestingly, you not only need to add the MinGW bin to your Path, but also you need to make sure that certain things are not on your path*. In my case, I saved my entire path variable as a backup, deleted everything non-system from my path except for MinGW and CMake, leaving:

有趣的是,您不仅需要将 MinGW bin 添加到您的路径中,还需要确保某些东西不在您的路径中*。就我而言,我将整个路径变量保存为备份,从我的路径中删除了除 MinGW 和 CMake 之外的所有非系统内容,留下:

C:\MinGW\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files (x86)\CMake\bin

You should use the appropriate elements from yoursystem path.

您应该使用合适的元素你的系统路径。

I first tried to do this with a batch job that launched CMake, but it seems that the CMake GUI was reaching back and grabbing the System 'Path' variable instead of the command prompt 'Path' variable, which I had printed and confirmed was as listed above before launching CMake.

我首先尝试使用启动 CMake 的批处理作业来执行此操作,但似乎 CMake GUI 正在返回并抓取系统“路径”变量而不是命令提示符“路径”变量,我已打印并确认其为在启动 CMake 之前列出了上面的内容。

Incidentally, I backed up the entire Windows VM before starting!

顺便说一句,我在开始之前备份了整个 Windows VM!

* For instance: various references, including known issues, mention sh.exe. I inherited this VM from my client and hacked it up further, so it's easier for me to use a clean path for my cross-compiling task and return afterward...

* 例如:各种参考资料,包括已知问题,提及 sh.exe。我从我的客户那里继承了这个 VM 并进一步修改了它,所以我更容易为我的交叉编译任务使用干净的路径并在之后返回......

回答by mdrissel

In just installed MinGW using the mingw-get-setup.exe v0.6.2beta-20131004-1 installer. Even though during the install I selected the gcc package, the installer didn't include the "mingw32-gmp" package, which includes libgmp-10.dll. I had to rerun the installer, chose the "Reinstall" option, and manually select the "mingw32-gmp dev" package.

在刚刚使用 mingw-get-setup.exe v0.6.2beta-20131004-1 安装程序安装的 MinGW 中。即使在安装过程中我选择了 gcc 包,安装程序也没有包含“mingw32-gmp”包,其中包括 libgmp-10.dll。我不得不重新运行安装程序,选择“重新安装”选项,然后手动选择“mingw32-gmp dev”包。

回答by tqirby

If you don't have the permission modifying your global path, you can also change the active directory of your cmd shell.

如果您没有修改全局路径的权限,您还可以更改 cmd shell 的活动目录。

How to do it (in the cmd shell):

怎么做(在 cmd shell 中):

C:\> cd C:\MINGW\bin
C:\MINGW\bin> gpp.exe C:\Users\James\Desktop\Program.cpp

How it doesn't work:

它如何不起作用:

C:\>C:\MINGW\bin\gpp.exe C:\Users\James\Desktop\Program.cpp

Note: you have to change "C:\Users\James\Desktop\Programm.cpp" to wherever your program lays

注意:您必须将“C:\Users\James\Desktop\Programm.cpp”更改为程序所在的位置

How it works: windows looks for needed DLLs while in the same directory and if it can't find it there it'll look in the PATH variables (so it will search system32 by default), if you add any missing DLLs to the directory from where you run it, windows looks and uses them (even before it looks in the PATH).

它是如何工作的:windows 在同一目录中查找所需的 DLL,如果在同一目录中找不到它,它将在 PATH 变量中查找(因此默认情况下它将搜索 system32),如果您将任何缺少的 DLL 添加到目录中从你运行它的地方,windows 会查找并使用它们(甚至在它在 PATH 中查找之前)。

回答by Kevin

A very simple fix to this problem of having missing driver file/s is to select and copyall the dll files from C:\MinGW\Bin and pastethem into your C:\MyPrograms or whereever else your folder for created c++ (.cpp) files are being located.

解决缺少驱动程序文件的问题的一个非常简单的方法是从 C:\MinGW\Bin 中选择并复制所有 dll 文件,然后将它们粘贴到 C:\MyPrograms 或任何其他用于创建 C++ (.cpp ) 文件正在被定位。