LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-26-2004, 06:38 PM   #1
Magus_Rune
LQ Newbie
 
Registered: Jul 2004
Distribution: RedHat (Shrike)
Posts: 8

Rep: Reputation: 0
Question 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?
 
Old 10-26-2004, 06:43 PM   #2
itsme86
Senior Member
 
Registered: Jan 2004
Location: Oregon, USA
Distribution: Slackware
Posts: 1,246

Rep: Reputation: 59
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.
 
Old 10-26-2004, 07:13 PM   #3
Magus_Rune
LQ Newbie
 
Registered: Jul 2004
Distribution: RedHat (Shrike)
Posts: 8

Original Poster
Rep: Reputation: 0
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?
 
Old 10-27-2004, 01:02 AM   #4
bushidozen
Member
 
Registered: Oct 2004
Posts: 215

Rep: Reputation: 30
Are you typing

./<filename>

That might do the trick (as itsme86 stated earlier).
 
Old 10-27-2004, 02:39 AM   #5
blackzone
Member
 
Registered: Jun 2004
Posts: 256

Rep: Reputation: 30
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
 
Old 10-27-2004, 12:13 PM   #6
tonyfreeman
Member
 
Registered: Sep 2003
Location: Fort worth, TX
Distribution: Debian testing 64bit at home, EL5 32/64bit at work.
Posts: 196

Rep: Reputation: 30
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Can Fedora Run All Programs that Redhat Entprise Can? sfwalter Linux - General 2 10-30-2004 05:42 AM
executing programs?!? cmargiol Linux - General 8 10-29-2003 02:38 PM
Executing X-Programs remotely frankieboy Linux - General 3 10-08-2003 02:31 AM
executing programs with arguments ? shaneblyth Mandriva 10 09-27-2003 08:01 PM
Executing Perl Programs 1huskerfan Programming 3 01-06-2002 07:39 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:59 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration