I'm running Eclipse Juno with CDT on Windows 7. Have installed MinGW with msys and set up my PATH. If I just run cmd.exe
and type make
, it runs the 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:
Program "make" not found in PATH
The funny thing is, if I run the following Java code from Eclipse...
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!?
For whatever reason, moving the MinGW and Msys paths to the front of the PATH variable (they are at the end in the question above) solved my problem.