我在 Windows 7 上运行带有 CDT 的 Eclipse Juno。已经用 msys 安装了 MinGW 并设置了我的 PATH。如果我只是运行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
到目前为止,一切都很好。但即使在重新启动 Eclipse(甚至重新启动 Windows!)之后,当我尝试制作简单的“Hello World”C 程序时,CDT 也会给我以下错误消息:
Program "make" not found in PATH
有趣的是,如果我从 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();
}
}
}
...我得到了我期望的输出,即:
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.
为什么 Eclipse CDTmake
在其他人都可以找到时却找不到!?