PDA

View Full Version : Linux exec not running


sid_galt
Jan15-06, 10:50 AM
I just reinstalled Suse Linux 10.0 with GNome interface. I tried to test c++ with a hello world application. I compiled it like this


g++ -o hello hello.cpp


Although the compiler built the executable file, when I tried to run it from the shell using exec, it said


bash:exec:hello: hello not found

What's the problem?

Thank you for the help

Shawnzyoo
Jan15-06, 02:24 PM
just try
./hello
or whatever the filename is
--shawn

ComputerGeek
Jan16-06, 01:37 AM
I just reinstalled Suse Linux 10.0 with GNome interface. I tried to test c++ with a hello world application. I compiled it like this

g++ -o hello hello.cpp

Although the compiler built the executable file, when I tried to run it from the shell using exec, it said

bash:exec:hello: hello not found
What's the problem?
Thank you for the help

a.out is the output. you can rename it what ever you like, but immediately after compilation, it is called a.out... you might have to do a ./a.out if you do not have "the current directory" in your search path.

franznietzsche
Jan16-06, 06:00 AM
a.out is the output. you can rename it what ever you like, but immediately after compilation, it is called a.out... you might have to do a ./a.out if you do not have "the current directory" in your search path.


Normally you would be right, but not in this case. He used the '-o' flag which changed the output filename to 'hello'.

As for why this is not working, are you sure it compiled correctly? Did you check to make sure that a file called 'hello' was in fact created? Because the output is telling you that that file is not there.