Danny Phung
Danny Phung

Reputation: 89

I am not able run C program in eclipse

I've been googling for about 2 days. Read and followed a lot of instructions but nothing worked for me (including some instructions in this website; I know that people already asked this question in here). I've downloaded Eclipse, installed the C/C++ plugin (window 7, 64 bit) but when I run the HelloWorld.c program, I get a pop-up message saying:

Launch Failed. Binary Not Found.

Here is what I have done in Eclipse:

  1. Window-->Preference-->New CDT Project Wizard-->Makefile Project-->Binary Parswer, make sure there is a checkmark infront of: "PE Window Parser".
  2. Project-->Properties-->C/C++ Build-->Settings-->Binary Parsers, make sure there is a checkmark infont of "PE Window Parser".
  3. Project-->Properties-->C/C++ Build-->Tool Chain Editor: in the Current toolchain, select: Cross GCC in the Currect builder, Select: Gnu Make Builder.
  4. set Eclipse CDT Auto Build

Here are steps I used to create the project:

  1. File-->new-->C Project. enter "Hello" in the "Project name:" field. Click Next button, make sure both Debug and Release are checked, click Next button again, click Finish button.
  2. Right click on Hello-->new-->Source File, enter HelloWorld.c, then click Finish button. enter the code below:

    #include <stdio.h>
    int main()
    {
    printf("Hello, world!\n");
    return 0;
    }
    
  3. Save and click on the "Hammer" icon to build project. then I got this message:

make all

Cannot run program "make": Launching failed

Error: Program "make" not found in PATH PATH=[C:\eclipse_Juno;C:/Program Files (x86)/Java/jre7/bin/client;C:/Program Files (x86)/Java/jre7/bin;C:/Program Files (x86)/Java/jre7/lib/i386;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;

21:35:25 Build Finished (took 280ms)

  1. Right click in the Text Editor area, Run As-->Local C/C++ Application a message pop up said: "Launch Failed.Binary not found"

I am not sure what I did wrong. Please point out why I am not able to run my program in Eclipse. Thanks in advance.

Upvotes: 6

Views: 11370

Answers (3)

Mohammad Kholghi
Mohammad Kholghi

Reputation: 783

I had the same problem minutes ago. Do this:

Write your program, like:

#include <stdio.h>

int main(){
    printf("Hello There\n");
    printf("salam");
}

Then press Ctrl + B for Build All. You can do this from Project -> Build All.

Then, go to Run -> Run Configuration and on the left menu, double click on C/C++ Application (1), then click on the new opened option: "Sth Debug"(2). Now, on the main window, under C/C++ Application:, under the edittext, click browse option(3). Open your workspace, open your project, open Debug folder (which is created after each build), and select your a file with the same name as ProjectFolderName, then click Run (8).

Important Note: Just select the file with the same name as ProjectFolderName without any suffix. Don't choose the files ending like: sth.d or sth.o. Just select file which has no suffix.

Important Note2: You can put ${workspace_loc}/${project_name}/Debug/${project_name} in the edittext too, but if you are using Windows, use backslashes() instead of slashes(/).

Look at the picture

Upvotes: 3

Akshit
Akshit

Reputation: 19

Let me put it simple for you in steps.

  1. Go download MinGw or Cygwin in windows for eclipse.
  2. Install any of them.
  3. Go to Build Properties of the project and make your current compiler to point this installation directory.
  4. Restart your Eclipse and try to build the program. Now, it should go fine with your running.

Problem Explanation:

  • Binary not found: means you don't have .o file for your project to execute. This file will only get created after successful build of the project.
  • Build Failed: is due to 'make' program is not available to Eclipse. That means, you don't have compiler with your eclipse to build the project.

Upvotes: 0

&#201;tienne
&#201;tienne

Reputation: 5022

The problem was that no compiler was installed, and that eclipse is an integrated development environment which doesn't integrate a compiler natively.

Upvotes: 2

Related Questions