Executing Programs in Redhat vs Fedora
Hello,
I am taking a computer science course in college, and thus far we've done all our C++ assignments on Fedora in the computer lab. For S&G I installed Red Hat on my computer, and I'm trying to do one of the assignments, but I have a small discrepancy. In Fedora I would type g++ to compile, and the a.out to excute. In Redhat g++ still appears to compile, but it won't recognize a.out for execution. Is there a different execution command for Redhat, or did I not add all the components when I installed? |
You can control what the output filename is:
g++ myprogram.cpp -o myprogram Then you can just run myprogram. It could be that . (current directory) isn't in your path. Try doing ./a.out or ./myprogram instead of just a.out or myprogram. |
Okay, so I control the output to a different file name, and then list the files in that directory, it shows both a.out, and that file...but when I try to run either one (by just typing in the file name) I get a bash saying the file is not found?
|
Are you typing
./<filename> That might do the trick (as itsme86 stated earlier). |
I believe you can only run a program directly if it is in the included path
to see the path type "echo $PATH" if it is not in the included path type "./a.out" to run the program |
You have to type a dot and a slash and the filename.
./a.out Why? Because the dot directory is probably not in your search/execute PATH environment variable. echo $PATH If the dot directory is in your path ... you should take it out and always use the ./ method of running your program. --Tony |
All times are GMT -5. The time now is 01:17 PM. |