LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Executing Programs in Redhat vs Fedora (https://www.linuxquestions.org/questions/programming-9/executing-programs-in-redhat-vs-fedora-247673/)

Magus_Rune 10-26-2004 06:38 PM

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?

itsme86 10-26-2004 06:43 PM

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.

Magus_Rune 10-26-2004 07:13 PM

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?

bushidozen 10-27-2004 01:02 AM

Are you typing

./<filename>

That might do the trick (as itsme86 stated earlier).

blackzone 10-27-2004 02:39 AM

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

tonyfreeman 10-27-2004 12:13 PM

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.