Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Linux exec not running

  1. Jan 15, 2006 #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 (Text):

    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 (Text):

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

    Thank you for the help
  2. jcsd
  3. Jan 15, 2006 #2
    just try
    or whatever the filename is
  4. Jan 16, 2006 #3
    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.
  5. Jan 16, 2006 #4

    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: Jan 16, 2006
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook