Linux exec not running

  • Thread starter sid_galt
  • Start date
  • #1
502
1
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

Code:
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

Code:
bash:exec:hello: hello not found
What's the problem?

Thank you for the help
 

Answers and Replies

  • #2
105
0
just try
./hello
or whatever the filename is
--shawn
 
  • #3
379
0
sid_galt said:
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
Code:
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
Code:
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.
 
  • #4
1,414
5
ComputerGeek said:
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.
 
Last edited:

Related Threads on Linux exec not running

Replies
1
Views
3K
Replies
1
Views
2K
Replies
2
Views
677
Replies
8
Views
6K
  • Last Post
Replies
1
Views
1K
  • Last Post
2
Replies
38
Views
2K
  • Last Post
Replies
5
Views
18K
  • Last Post
Replies
6
Views
2K
Replies
2
Views
2K
Top