Click to See Complete Forum and Search --> : C++ programs don't run...


apeterson
05-01-2001, 09:22 PM
I've got a little problem... it's probably something really simple, but I can't seem to figure it out! First of all, I've made a file in vi and saved it hello.cc for a c++ program. Then, at the command prompt I typed:

g++ -o hello hello.cc

After that, there is what looks like an executable called hello in my folder, but if I type <i>hello</i> at the command prompt, it says the command can't be found (I'm not exactly sure what the error message is... I'm working on this at school, and I'm at home now). Does anyone have any suggestions? Thanks.

-Adam Peterson

Oh, one more thing. I'm certain I typed the c++ code properly, so don't assume that it might be the problem ;)

Bradmont2
05-01-2001, 09:25 PM
For any executable not in a directory in your PATH environment variable, you have to tell the system exactly where the file is. If it is in the current directory, you have to type ./hello. (. for the current directory). If it was in a dir called moo, which is a subdirectory of the current directory, you would type moo/hello.