简体   繁体   English

Eclipse CDT - 无法找到程序“make”(win7,mingw,msys已安装)

[英]Eclipse CDT — program “make” cannot be found (win7, mingw, msys installed)

I'm running Eclipse Juno with CDT on Windows 7. Have installed MinGW with msys and set up my PATH. 我在Windows 7上运行带有CDT的Eclipse Juno。已经安装了带有msys的MinGW并设置了我的PATH。 If I just run cmd.exe and type make , it runs the msys make.exe : 如果我只运行cmd.exe并输入make ,它将运行msys make.exe

C:\Users\dev>make
make: *** No targets specified and no makefile found.  Stop.

C:\Users\dev>echo %PATH%
C:\Program Files (x86)\Windows Resource Kits\Tools\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\MySQL\MySQL Server 5.5\bin;C:\Program Files (x86)\php;C:\Program Files (x86)\libtidy\bin;C:\Program Files\7-Zip;C:\Program Files\TortoiseSVN\bin;C:\Program Files\Java\jdk1.7.0\bin;C:\Program Files (x86)\apache-ant-1.8.4\bin;C:\Program Files\TortoiseHg\;C:\Program Files (x86)\Windows Resource Kits\Tools\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\MySQL\MySQL Server 5.5\bin;C:\Program Files (x86)\php;C:\Program Files (x86)\libtidy\bin;C:\Program Files\7-Zip;C:\Program Files\TortoiseSVN\bin;C:\Program Files\Java\jdk1.7.0\bin;C:\Program Files (x86)\apache-ant-1.8.4\bin;C:\Program Files\TortoiseHg\;C:\Program Files (x86)\MinGW\bin;C:\Program Files (x86)\MinGW\msys\1.0\bin

So far so good. 到现在为止还挺好。 But even after restarting Eclipse (even rebooting Windows!), CDT gives me the following error message when I try to make the simple "Hello World" C program: 但即使重启Eclipse(甚至重启Windows!),当我尝试制作简单的“Hello World”C程序时,CDT也会给出以下错误消息:

Program "make" not found in PATH

Eclipse错误输出

The funny thing is, if I run the following Java code from Eclipse... 有趣的是,如果我从Eclipse运行以下Java代码...

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Temp {
    public static void main(String[] args) {
        System.out.println(System.getenv("PATH"));
        try {
            String line;
            Process p = Runtime.getRuntime().exec("make");
            BufferedReader input =
              new BufferedReader
                (new InputStreamReader(p.getErrorStream()));
            while ((line = input.readLine()) != null) {
                System.out.println(line);
            }
            input.close();
          }
          catch (Exception err) {
            err.printStackTrace();
          }
    }
}

...I get exactly the output I would expect, namely: ...我得到了我期望的输出,即:

C:\Program Files (x86)\Windows Resource Kits\Tools\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\MySQL\MySQL Server 5.5\bin;C:\Program Files (x86)\php;C:\Program Files (x86)\libtidy\bin;C:\Program Files\7-Zip;C:\Program Files\TortoiseSVN\bin;C:\Program Files\Java\jdk1.7.0\bin;C:\Program Files (x86)\apache-ant-1.8.4\bin;C:\Program Files\TortoiseHg\;C:\Program Files (x86)\MinGW\bin;C:\Program Files (x86)\MinGW\msys\1.0\bin
make: *** No targets specified and no makefile found.  Stop.

Why can't Eclipse CDT find make when everybody else can!? 为什么Eclipse CDT找不到别人可以make时候!?

无论出于何种原因,将MinGW和Msys路径移动到PATH变量的前面(它们在上面的问题的末尾)解决了我的问题。

Also after adding C:\\MinGW\\bin to PATH variable. 在将C:\\MinGW\\bin到PATH变量之后。 Make sure your new project is created with MinGW GCC toolchain as shown below. 确保使用MinGW GCC工具链创建新项目,如下所示。

在此输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM