程序无法启动,因为 Eclipse CDT 中缺少 cygwin1.dll...

发布于 2024-11-25 06:13:39 字数 1370 浏览 3 评论 0原文

我的计算机上安装 Eclipse for Java 已有几年了,决定安装 CDT 并学习 C。我安装了 MinGWCygwin,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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

遮云壑 2024-12-02 06:13:39

此错误消息意味着 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.

不念旧人 2024-12-02 06:13:39

您可以使用 Cygwin 的 g++ 或 MinGW 进行编译(通过独立或使用 Cygwin 软件包)。但是,为了运行它,您需要将 Cygwin1.dll (和其他)路径添加到系统 Windows 路径中,位于任何 cygwin 样式路径之前。

因此,将 ;C:\cygwin64\bin 添加到 Windows 系统 PATH<的末尾 /代码> 变量。

此外,要编译以在 CMDPowerShell 中使用,您可能需要使用:

x86_64-w64-mingw32-g++.exe -static -std=c++11 prog_name.cc -o prog_name.exe

(这会调用交叉编译器,如果已安装。)

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 system Windows PATH, before any cygwin style paths.

Thus add: ;C:\cygwin64\bin to the end of your Windows system PATH variable.

Also, to compile for use in CMD or PowerShell, you may need to use:

x86_64-w64-mingw32-g++.exe -static -std=c++11 prog_name.cc -o prog_name.exe

(This invokes the cross-compiler, if installed.)

诗酒趁年少 2024-12-02 06:13:39

要添加到此并保存某人另一个谷歌,只需在 cmd 中执行以下操作:

set PATH=%PATH%;C:\cygwin64\bin

To add to this and save someone another google, just do this in cmd:

set PATH=%PATH%;C:\cygwin64\bin
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文