LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-04-2010, 09:30 AM   #1
jadhravi
LQ Newbie
 
Registered: Jan 2010
Posts: 27

Rep: Reputation: 15
Binary not found.


When i try to write a simple c++ application using eclipse gallieo i get an error
like

g++ -o"Hello1" ./test.o
/usr/lib/gcc/i486-linux-gnu/4.3.3/../../../../lib/crt1.o: In function `_start':
/build/buildd/glibc-2.9/csu/../sysdeps/i386/elf/start.S:115: undefined reference to `main'
collect2: ld returned 1 exit status
make: *** [Hello1] Error 1

and when I try to run the same file i get an error as launch failed .

I am using ubuntu 9.04.

solutions?

thank u!!
 
Old 04-04-2010, 10:57 AM   #2
AlucardZero
Senior Member
 
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,824

Rep: Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615
Post your code.
 
Old 04-04-2010, 11:27 AM   #3
jadhravi
LQ Newbie
 
Registered: Jan 2010
Posts: 27

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by AlucardZero View Post
Post your code.
The code written is
#include <iostream>
using namespace std;
int main()
{
cout<<"Hello"<<endl;
}
 
Old 04-04-2010, 12:31 PM   #4
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by jadhravi View Post
When i try to write a simple c++ application using eclipse gallieo i get an error
like

g++ -o"Hello1" ./test.o
/usr/lib/gcc/i486-linux-gnu/4.3.3/../../../../lib/crt1.o: In function `_start':
/build/buildd/glibc-2.9/csu/../sysdeps/i386/elf/start.S:115: undefined reference to `main'
collect2: ld returned 1 exit status
make: *** [Hello1] Error 1

and when I try to run the same file i get an error as launch failed .

I am using ubuntu 9.04.

solutions?

thank u!!
The command line you show contains no input files in C++, just an object file. So, it's linking only command.

Where is compilation ? And for your simple program one command line is sufficient for both linking and compilation.

Why do you use Eclipse in the first place ?
 
Old 04-04-2010, 07:27 PM   #5
graemef
Senior Member
 
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,379

Rep: Reputation: 148Reputation: 148
Try compiling your code as:

Code:
g++ -o "Hello" test.cpp
Assuming that your source code file is called test.cpp, and that you are in the same directory as the file. This will create an object (test.o) file which will be linked to an executable Hello.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Binary file cannot be found. dmuffet Programming 3 01-30-2010 01:14 PM
XOR Binary Stream Against a Known Binary Key telecom_is_me Programming 14 07-04-2008 07:10 PM
LXer: To binary or not to binary, that is the question LXer Syndicated Linux News 0 12-31-2006 09:33 AM
LXer: Root exploit found in binary NVIDIA driver LXer Syndicated Linux News 0 10-17-2006 08:21 AM
Do I need binary 1 and binary 2 dvd iso for base install? salah-ad-din Debian 5 08-15-2006 04:43 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:16 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration