Binary not found in eclipse to run C

  • Bogey
  • Genius
  • Genius
  • Bogey
  • Posts: 8399
  • Loc: USA

Post 3+ Months Ago

I'm trying to run the following code in C:
C Code: [ Select ]
//C hello world example
#include <stdio.h>
 
int main()
{
  printf("Hello world\n");
  return 0;
}
  1. //C hello world example
  2. #include <stdio.h>
  3.  
  4. int main()
  5. {
  6.   printf("Hello world\n");
  7.   return 0;
  8. }

I found that code here.

It is probably because I'm including stdio.h which is the binary that is not found (or something else entirely)... I don't know the language well so I don't know.

I remember running this kind of code before and it did run like it was supposed to...

Anyway, if I try running that code, I get the following error.
Quote:
Launch failed. Binary not found.
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • Bogey
  • Genius
  • Genius
  • Bogey
  • Posts: 8399
  • Loc: USA

Post 3+ Months Ago

It might be my PATHs variables, but I know nothing about paths, where they're at (environments maybe?), what they should be, how many of them there should be...
  • Bogey
  • Genius
  • Genius
  • Bogey
  • Posts: 8399
  • Loc: USA

Post 3+ Months Ago

If I try to build I get the following notice:
Quote:
Nothing to build for project Hello World

For run, I have Auto Build set up.

Now it says (after I did clean)
Quote:
The selection cannot be launched, and there are no recent launches.


Edit2: Now it's back to the not found binary thing...
  • Bogey
  • Genius
  • Genius
  • Bogey
  • Posts: 8399
  • Loc: USA

Post 3+ Months Ago

Okay, I figured it out... Apparently when I add a new source file and name it, it doesn't add the .c extension automatically, and I'm supposed to do that myself. After adding the extension, it fixed my problem.

Now I got the following notice in the Console:

Quote:
<terminated> Hello World Debug [C/C++ Application] C:\Users\path\to\Hello World.exe (4/15/14, 9:51PM)


Edit2: In the project file tree, the exe looks like:

Hello World.exe - [x86/le]

Edit3: I get the following thing in the console during build.
Quote:
23:51:10 **** Incremental Build of configuration Debug for project Hello World ****
make all
Building file: ../hello.c
Invoking: Cygwin C Compiler
gcc -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"hello.d" -MT"hello.d" -o "hello.o" "../hello.c"
cygwin warning:
MS-DOS style path detected: C:\Users\Username\workspace\Hello World\Debug
Preferred POSIX equivalent is: /cygdrive/c/Users/Username/workspace/Hello World/Debug
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.h ... -pathnames
Finished building: ../hello.c

Building target: Hello World.exe
Invoking: Cygwin C Linker
gcc -o "Hello World.exe" ./hello.o
Finished building target: Hello World.exe


23:51:11 Build Finished (took 921ms)


Edit4: Well, I changed the paths to POSIX and get the following in the console for build
Quote:
23:58:03 **** Incremental Build of configuration Debug for project Hello World ****
make all
Building file: ../hello.c
Invoking: Cygwin C Compiler
gcc -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"hello.d" -MT"hello.d" -o "hello.o" "../hello.c"
Finished building: ../hello.c

Building target: Hello World.exe
Invoking: Cygwin C Linker
gcc -o "Hello World.exe" ./hello.o
Finished building target: Hello World.exe


23:58:04 Build Finished (took 827ms)

The thing is though, it's still terminated for some reason

Edit5: Apparently POSIX paths I changed them into were wrong...

I've tried:

/cygdrive/c/and/so/on

and

/c/and/so/on

But they're not right (manual says that Cygwin converts Win32 URLs to POSIX, and that the use of Win32 URLs in Cygwin is deprecated...)

With those POSIX in there, I get the error which says "Program MAKE not found in PATH"

Edit6: Wow!!! So much trouble to run a simple program!!! :lol:
  • spork
  • Brewmaster
  • Silver Member
  • User avatar
  • Posts: 6252
  • Loc: Seattle, WA

Post 3+ Months Ago

Side question: why are you trying to use Eclipse for this? In your other thread I thought you wanted to just compile/run via the command line, which I'd recommend if you're just starting out.

Eclipse is far too heavyweight for this, IMO.
  • Bogey
  • Genius
  • Genius
  • Bogey
  • Posts: 8399
  • Loc: USA

Post 3+ Months Ago

I think so too... I just don't know how to do it command line and Eclipse is too much trouble than it's worth.
  • spork
  • Brewmaster
  • Silver Member
  • User avatar
  • Posts: 6252
  • Loc: Seattle, WA

Post 3+ Months Ago

I think you should look into MinGW. It will give you a port of GCC for Windows and a bunch of useful "UNIX-y" tools.

http://www.mingw.org

Stay away from IDE's like Eclipse, Visual Studio, etc. until you're comfortable building and running on the command line.

Post Information

  • Total Posts in this topic: 7 posts
  • Users browsing this forum: No registered users and 133 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.