C语言 Eclipse CDT 插件问题

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7134304/
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-09-02 09:26:26  来源:igfitidea点击:

Eclipse CDT plugin problems

ceclipsemingweclipse-cdtmsys

提问by chmoder

im trying to run a c program on my windows 7 computer using eclipse and im running into a little snag. I currently have Eclipse downloaded on my computer with the CDT plugin and i have also downloaded Mingw and set it to my path. When i build my simple "Hello world" program it does create a debug file with the makefile and everything in it but the concle dialog states

我正在尝试使用 Eclipse 在我的 Windows 7 计算机上运行 ac 程序,但我遇到了一个小问题。我目前在我的计算机上下载了带有 CDT 插件的 Eclipse,我还下载了 Mingw 并将其设置为我的路径。当我构建简单的“Hello world”程序时,它确实创建了一个调试文件,其中包含 makefile 及其中的所有内容,但 concle 对话框指出

**** Build of configuration Debug for project C_Test ****

make all 

`Cannot run program "make" (in directory "C:\Users\Chmoder\workspace\C_Test\Debug"): CreateProcess error=2, The system cannot find the file specified Error: Program "make" is not found in PATH

PATH=[C:\Users\Chmoder\Downloads\eclipse;C:\MINGW\Bin;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\ATI Stream\bin\x86_64;C:\Program Files (x86)\ATI Stream\bin\x86;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;c:\Program Files (x86)\Common Files\Roxio Shared\DLLShared\;c:\Program Files (x86)\Common Files\Roxio Shared\12.0\DLLShared\;C:\Program Files (x86)\Windows Live\Shared]`

`无法运行程序“make”(在目录“C:\Users\Chmoder\workspace\C_Test\Debug”中):CreateProcess error=2, The system cannot find the file specified Error: Program “make” is not found in PATH

PATH=[C:\Users\Chmoder\Downloads\eclipse;C:\MINGW\Bin;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared \Windows Live;C:\Program Files (x86)\ATI Stream\bin\x86_64;C:\Program Files (x86)\ATI Stream\bin\x86;C:\Windows\system32;C:\Windows;C: \Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;c:\Program Files (x86)\ Common Files\Roxio Shared\DLLShared\;c:\Program Files (x86)\Common Files\Roxio Shared\12.0\DLLShared\;C:\Program Files (x86)\Windows Live\Shared]`

Also, when i try to run my program after building it, it says "Binary not found"

此外,当我在构建程序后尝试运行我的程序时,它显示“找不到二进制文件”

any help people?

任何帮助人?

回答by user1506074

Another solution is to set the MINGW_HOME variable in eclipse.ini :

另一种解决方案是在 eclipse.ini 中设置 MINGW_HOME 变量:

-DMINGW_HOME=C:\Program Files (x86)\CodeBlocks\MinGW

This avoid to change the system PATH (often requires administrator rights)

这避免更改系统PATH(通常需要管理员权限)

(solution suggested by help of eclipse / CDT)

在 eclipse / CDT 的帮助下建议的解决方案)

回答by osgx

The error is: there is no makein %PATH. Make is UNIX utility to help building a projects. For windows OS, the makeutility is part of msys, not of mingw32.

错误是:make%PATH 中没有。Make 是帮助构建项目的 UNIX 实用程序。对于 Windows 操作系统,该make实用程序是 msys 的一部分,而不是 mingw32。

According to your path and to my setup of mingw and msys, you have no msys installed (or the path of Msys was not recorded in system %PATH variable).

根据您的路径以及我对 mingw 和 msys 的设置,您没有安装 msys(或者系统 %PATH 变量中未记录 Msys 的路径)。

For you, msys will be like this path in $PATH variable:

对你来说,msys 就像 $PATH 变量中的这个路径:

  C:\MINGW\msys.0\Bin;

Msys can be downloaded from http://www.mingw.org/too.

Msys 也可以从http://www.mingw.org/下载。

If you did a download of universal installer (it is the easiest variant), you just should check, is there a make.exefile in the C:\MINGW\msys\1.0\Bindirectory and add this directory to the system PATH variable.

如果您下载了通用安装程序(这是最简单的变体),您只需检查目录中是否有make.exe文件C:\MINGW\msys\1.0\Bin并将此目录添加到系统 PATH 变量中。

回答by Dolan Antenucci

For me (on OS X), even though my personal environment (i.e. if in bash, echo $PATH) had /Developer/usr/bin in it, I still had to add it to Eclipse's Environment variables:

对于我(在 OS X 上),即使我的个人环境(即如果在 bash 中,echo $PATH)中有 /Developer/usr/bin,我仍然必须将它添加到 Eclipse 的环境变量中:

Go to Eclipse Preferences -> C/C++ -> Environment -> Add.. -> "${PATH}:/Developer/usr/bin

转到 Eclipse Preferences -> C/C++ -> Environment -> Add.. -> "${PATH}:/Developer/usr/bin

In the case of cygwin, you'd just put the right directory to where makeis.

在 cygwin 的情况下,您只需将正确的目录放在 where makeis 。

This was confusing for me, so figured share the details that helped me. :)

这让我很困惑,所以想分享对我有帮助的细节。:)

source: eclipse forum postvia Adel on another SO post.

来源:eclipse 论坛帖子通过Adel 在另一个 SO 帖子上

回答by user3007390

  • Goto "Window"->"Prefenerces"->"C++"->"Build"->"Environment"
  • add "COMMAND"="c:\mingw\bin\make.exe"`.
  • on the other side, you need a batch file "c:\mingw\bin\rm.bat"
  • In that file, put:

    @echo off
    :start
        if "%1" == "" goto end
        if "%1" == "-f" goto loop
        del %1
    :loop
        shift
        goto start
    :end
    
  • 转到“窗口”->“偏好”->“C++”->“构建”->“环境”
  • 添加 "COMMAND"="c:\mingw\bin\make.exe"`。
  • 另一方面,您需要一个批处理文件 "c:\mingw\bin\rm.bat"
  • 在该文件中,输入:

    @echo off
    :start
        if "%1" == "" goto end
        if "%1" == "-f" goto loop
        del %1
    :loop
        shift
        goto start
    :end
    

回答by Eria Lopez

I had the same problem with eclipse Luna version.

我在 eclipse Luna 版本中遇到了同样的问题。

I could not even compile the "Hello World" example that comes embedded in the IDE. It kept saying that make file was not found in the path even though it was.

我什至无法编译嵌入在 IDE 中的“Hello World”示例。它一直说即使在路径中找不到 make 文件。

I tried every suggestion in this forum (making sure the path was in Windows and Eclipse variables, and making the rm.bat file) but nothing helped.

我尝试了这个论坛中的所有建议(确保路径在 Windows 和 Eclipse 变量中,并制作 rm.bat 文件)但没有任何帮助。

What I did is that I copied make.exe from C:\MINGW\msys\1.0\Bin and paste it into the folder where eclipse.exe resides. This might not be the optimal solution but it solved it.

我所做的是从 C:\MINGW\msys\1.0\Bin 复制 make.exe 并将其粘贴到 eclipse.exe 所在的文件夹中。这可能不是最佳解决方案,但它解决了它。