Nothing executes!

Nothing executes!

Post by wackym » Sun, 30 May 1999 04:00:00



Hello.  I have RedHat 5.0.  When I try to compile any C/C++ or any program,
it compiles just fine,
but the executable is non executable.  I use the chmod utility, but still
nothing will execute.  In other words, say I have this:

#include <iostream.h>
int main(void)
{
    cout << "Hello world\n";
    return 0;

Quote:}

Then I do:
    g++ hello.cpp
The result is the a.out file.
At the command prompt, I type in: a.out
Well, the a.out file won't execute.  I used the chmod and the permissions
get set, but nothing happens.
What gives?

Thank you.

 
 
 

Nothing executes!

Post by Anders Gulden Olsta » Sun, 30 May 1999 04:00:00


[snip]

Quote:> Well, the a.out file won't execute.  I used the chmod and the permissions
> get set, but nothing happens.
> What gives?

Current Working Directory "./" is not in the default PATH in Linux, for some
security reasons.

 # echo $PATH
 will show your current PATH

To run binaries outside the directories in the PATH variable, you'll have
to type "./<filename>" to indicate that the file resides in your current
directory.

--

RedHat 5.2 Linux kernel 2.0.36  | "Penguins are generally nice creatures"

 
 
 

Nothing executes!

Post by Colin Wats » Sun, 30 May 1999 04:00:00




> #include <iostream.h>
> int main(void)
> {
>     cout << "Hello world\n";
>     return 0;
> }

> Then I do:
>     g++ hello.cpp
> The result is the a.out file.
> At the command prompt, I type in: a.out
> Well, the a.out file won't execute.  I used the chmod and the permissions
> get set, but nothing happens.
> What gives?

./a.out

The current directory is not in your $PATH by default. For root, it
shouldn't be; for a user, you can add it.

--
Colin Watson                                      [cjw44 at cam.ac.uk]
Trinity College, Cambridge, and Computer Science       [riva.ucam.org]
"Oh Danny Boy, the pipes, the pipes are calling,
 From glen to glen, and down the mountainside ..."

 
 
 

Nothing executes!

Post by Paul Kimo » Sun, 30 May 1999 04:00:00



> Current Working Directory "./" is not in the default PATH in Linux, for some
> security reasons.

So you do not inadvertently run some unexpected executable when
visiting different directories.

--