程序无法启动,因为缺少 cygwin1.dll... 在 Eclipse CDT 中
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6752578/
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
The program can't start because cygwin1.dll is missing... in Eclipse CDT
提问by Shawn Walton
I've had Eclipse for Java on my computer for a few years, and decided to install the CDT and learn C. I installed both MinGW
and Cygwin
and the CDT detects and tries to use them when I make a new project.
我已经在我的计算机上安装了 Java Eclipse 几年了,并决定安装 CDT 并学习 C。我安装了MinGW
和Cygwin
并且 CDT 在我创建一个新项目时检测并尝试使用它们。
I choose File > New C++ Project
and choose Hello World C++ Project
and the CygwinGCC
toolchain. I name the project "asdf" and hit "Build Debug" in the toolbar. The compiler completes without error. I hit Run and nothing happens.
我选择File > New C++ Project
,选择Hello World C++ Project
和CygwinGCC
工具链。我将项目命名为“asdf”并点击工具栏中的“Build Debug”。编译器完成没有错误。我点击了运行,什么也没发生。
Browsing to the project directory manually and running asdf.exe gives me an error saying:"The program can't start because cygwin1.dll is missing from your computer. Try reinstalling the program to fix this problem."
手动浏览到项目目录并运行 asdf.exe 给我一个错误说:"The program can't start because cygwin1.dll is missing from your computer. Try reinstalling the program to fix this problem."
The same thing happens using MinGW, only a different dll is missing.
What do I need to do to have a usable .exe?
(I'm running Windows 7 x64 and the newest version of Eclipse and the CDT.)
使用 MinGW 也会发生同样的事情,只是缺少一个不同的 dll。
我需要做什么才能拥有可用的 .exe?
(我正在运行 Windows 7 x64 以及最新版本的 Eclipse 和 CDT。)
EDIT: The compiler output is as follows:
编辑:编译器输出如下:
**** Build of configuration Debug for project asdf ****
make all
Building file: ../src/asdf.cpp
Invoking: Cygwin C++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/asdf.d" -MT"src/asdf.d" -o"src/asdf.o" "../src/asdf.cpp"
cygwin warning:
MS-DOS style path detected: C:\Users\Shawn\Dropbox\eclipse\asdf\Debug
Preferred POSIX equivalent is: /cygdrive/c/Users/Shawn/Dropbox/eclipse/asdf/Debug
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
Finished building: ../src/asdf.cpp
Building target: asdf.exe
Invoking: Cygwin C++ Linker
g++ -o"asdf.exe" ./src/asdf.o
Finished building target: asdf.exe
回答by phlogratos
This error message means that Windows isn't able to find "cygwin1.dll". The Programs that the Cygwin gcc create depend on this DLL. The file is part of cygwin , so most likely it's located in C:\cygwin\bin. To fix the problem all you have to do is add C:\cygwin\bin (or the location where cygwin1.dll can be found) to your system path. Alternatively you can copy cygwin1.dll into your Windows directory.
此错误消息意味着 Windows 无法找到“cygwin1.dll”。Cygwin gcc 创建的程序依赖于这个 DLL。该文件是 cygwin 的一部分,因此很可能它位于 C:\cygwin\bin 中。要解决此问题,您只需将 C:\cygwin\bin(或可以找到 cygwin1.dll 的位置)添加到您的系统路径中。或者,您可以将 cygwin1.dll 复制到您的 Windows 目录中。
There is a nice tool called DependencyWalkerthat you can download from http://www.dependencywalker.com. You can use it to check dependencies of executables, so if you inspect your generated program it tells you which dependencies are missing and which are resolved.
有一个很好的工具叫做DependencyWalker,你可以从http://www.dependencywalker.com下载。您可以使用它来检查可执行文件的依赖关系,因此如果您检查生成的程序,它会告诉您哪些依赖关系缺失以及哪些已解决。
回答by not2qubit
You can compile with either Cygwin's g++
or MinGW (via stand-alone or using Cygwin package). However, in order to run it, you need to add the Cygwin1.dll
(and others) PATH to the systemWindows PATH, before any cygwin style paths.
您可以使用 Cygwing++
或 MinGW(通过独立或使用 Cygwin 包)进行编译。但是,为了运行它,您需要在任何 cygwin 样式路径之前将Cygwin1.dll
(和其他)PATH 添加到系统Windows PATH。
Thus add: ;C:\cygwin64\bin
to the endof your Windows systemPATH
variable.
因此添加:;C:\cygwin64\bin
到您的 Windows系统变量的末尾。PATH
Also, to compile for use in CMDor PowerShell, you may need to use:
此外,要编译以在CMD或PowerShell 中使用,您可能需要使用:
x86_64-w64-mingw32-g++.exe -static -std=c++11 prog_name.cc -o prog_name.exe
(This invokes the cross-compiler, if installed.)
(这将调用交叉编译器,如果已安装。)