程序无法启动,因为 Eclipse CDT 中缺少 cygwin1.dll...
我的计算机上安装 Eclipse for Java 已有几年了,决定安装 CDT 并学习 C。我安装了 MinGW
和 Cygwin
,CDT 检测到并当我做一个新项目时尝试使用它们。
我选择文件>新建 C++ 项目
,然后选择 Hello World C++ 项目
和 CygwinGCC
工具链。我将项目命名为“asdf”并点击工具栏中的“Build Debug”。编译器完成,没有错误。我点击“运行”,但什么也没发生。
手动浏览到项目目录并运行 asdf.exe 会出现错误:“程序无法启动,因为您的计算机中缺少 cygwin1.dll。请尝试重新安装程序来解决此问题。”
使用 MinGW 也会发生同样的情况,只是缺少不同的 dll。
我需要做什么才能获得可用的 .exe?
(我正在运行 Windows 7 x64 以及最新版本的 Eclipse 和 CDT。)
编辑: 编译器输出如下:
**** 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
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.
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.
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."
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.)
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
此错误消息意味着 Windows 无法找到“cygwin1.dll”。 Cygwin gcc 创建的程序依赖于此 DLL。该文件是 cygwin 的一部分,因此很可能位于 C:\cygwin\bin 中。要解决此问题,您只需将 C:\cygwin\bin (或可以找到 cygwin1.dll 的位置)添加到系统路径中。或者,您可以将 cygwin1.dll 复制到 Windows 目录中。
有一个名为 DependencyWalker 的好工具,您可以从 http://www.dependencywalker.com< 下载/a> .您可以使用它来检查可执行文件的依赖关系,因此,如果您检查生成的程序,它会告诉您哪些依赖关系丢失以及哪些依赖关系已解决。
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.
There is a nice tool called DependencyWalker that 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.
您可以使用 Cygwin 的
g++
或 MinGW 进行编译(通过独立或使用 Cygwin 软件包)。但是,为了运行它,您需要将Cygwin1.dll
(和其他)路径添加到系统 Windows 路径中,位于任何 cygwin 样式路径之前。因此,将
;C:\cygwin64\bin
添加到 Windows 系统PATH<的末尾 /代码> 变量。
此外,要编译以在 CMD 或 PowerShell 中使用,您可能需要使用:
(这会调用交叉编译器,如果已安装。)
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 theCygwin1.dll
(and others) PATH to the system Windows PATH, before any cygwin style paths.Thus add:
;C:\cygwin64\bin
to the end of your Windows systemPATH
variable.Also, to compile for use in CMD or PowerShell, you may need to use:
(This invokes the cross-compiler, if installed.)
要添加到此并保存某人另一个谷歌,只需在 cmd 中执行以下操作:
To add to this and save someone another google, just do this in cmd: