views:

641

answers:

3

How can I compile C++ .cpp files in the Eclipse IDE. I have CDT installed but when I try to execute it, I get a "Launch Failed. Binary not found." I do not want to install CYGWIN unless it is absolutely necessary.

+2  A: 

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

paxdiablo
What is the best compiler for c/c++. gcc?
Mohit Deshpande
That's a pretty subjective question. GCC is my tool of choice for Eclipse - the only other alternatives I've used or seen are Code::Blocks (this is a separate IDE), the free MSVC compiler and the professional MSVC compiler (at work, where I didn't have to fund it).
paxdiablo
How do I incorperate the MSVC compiler into Eclipse. Or must my projects be in MS Visual C++?
Mohit Deshpande
If you want to use the MSVC compiler, I'd suggest using their IDE. It may be doable, using the MSVC command line compiler behind Eclipse but, if you're paying Microsoft anyway, why suffer the extra effort?
paxdiablo
Sorry, I just realized I may not have been clear. When I said I'd used Code::Blocks and MSVC, that was *not* as a back end for Eclipse. I've only ever used gcc for Eclipse either the "real" one (on Linux) or the MinGW gcc (on Windows). Thought I'd better clear that up.
paxdiablo
A: 

"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).

Matthew
A: 

Hello Matthew, I have already tried running my program as a local c/c++ app but I'm still getting the error: "Launch failed. Binary not found." Any other suggestions?

Thanks

linziza