LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Binary not found. (https://www.linuxquestions.org/questions/programming-9/binary-not-found-799935/)

jadhravi 04-04-2010 09:30 AM

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!!

AlucardZero 04-04-2010 10:57 AM

Post your code.

jadhravi 04-04-2010 11:27 AM

Quote:

Originally Posted by AlucardZero (Post 3923881)
Post your code.

The code written is
#include <iostream>
using namespace std;
int main()
{
cout<<"Hello"<<endl;
}

Sergei Steshenko 04-04-2010 12:31 PM

Quote:

Originally Posted by jadhravi (Post 3923807)
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 ?

graemef 04-04-2010 07:27 PM

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.


All times are GMT -5. The time now is 06:56 PM.