Compile C++ in Eclipse?
How can I compile C++ .cpp files in the Eclipse IDE. I have CDT installed but when I tr开发者_JAVA百科y to execute it, I get a "Launch Failed. Binary not found." I do not want to install CYGWIN unless it is absolutely necessary.
The CDT only provides you with the facilities in Eclipse to edit and understand C files. It does not, to my knowledge, incorporate a compiler (unlike the JDT).
You need to install and configure a C compiler that the CDT can use.
If you're on Linux, you'll probably already have gcc installed that you can use. The only time I ever had to install a C development environment under Windows, I actually used MinGW although you could use Cygwin since it comes with the gcc compiler as well.
I used MinGW since it's only the development suite (hence the "minimalist" in "Minimalist GNU for Windows") whereas Cygwin include all sorts of extra stuff
"Launch Failed. Binary not found" doesn't mean that it couldn't compile but that the binary that was compiled couldn't be found by the IDE. One possibility is that the compile failed (errors). Most the time I get this error I just right-click the binary (in the folder's explorer)-> run as -> local c++ application, and it runs fine.
You should be able to hookup any compiler that will work on your system. Under project properties, look around in C/C++ Build. I think the took chain editor is where you'd hook up another compiler, but its been a long time since I've done so.
This is the link from CSE 12 @ UCSD that I used to get MinGW working with Eclipse (in Windows).
精彩评论