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

时间:2011-07-19 18:59:17

标签: eclipse dll cygwin exe eclipse-cdt

我已经在我的计算机上安装了Eclipse for Java几年,并决定安装CDT并学习C.我安装了MinGWCygwin并且CDT检测并尝试使用当我做一个新项目时,他们。

我选择File > New C++ Project并选择Hello World C++ ProjectCygwinGCC工具链。我将项目命名为“asdf”并点击工具栏中的“Build Debug”。编译器完成且没有错误。我点击Run并没有任何反应。

手动浏览项目目录并运行asdf.exe会给出错误说:
"The program can't start because cygwin1.dll is missing from your computer. Try reinstalling the program to fix this problem."

使用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

2 个答案:

答案 0 :(得分:62)

此错误消息表示Windows无法找到“cygwin1.dll”。 Cygwin gcc创建的程序依赖于此DLL。该文件是cygwin的一部分,因此很可能它位于C:\ cygwin \ bin中。要解决此问题,您只需将C:\ cygwin \ bin(或可以找到cygwin1.dll的位置)添加到系统路径中。或者,您可以将cygwin1.dll复制到Windows目录中。

有一个名为 DependencyWalker 的好工具可以从http://www.dependencywalker.com下载。您可以使用它来检查可执行文件的依赖关系,因此,如果您检查生成的程序,它会告诉您哪些依赖项已丢失,哪些依赖项已解决。

答案 1 :(得分:1)

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

因此将 ;C\cygwin64\bin 添加到Windows 系统 PATH变量的结束

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

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

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