 |
 |
How to run a.out?
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Jun 2006
Status:
Offline
|
|
In my computer science class (C++) we have been using Emacs to write the programs, and then using g++ to create the computers. It works fine on the campus *nix boxes.
On my MacBook, I have no problem compiling it (ex. "g++ text.cpp"). It then spits out a program, "a.out". On the campus machines, I just have to type in "a.out" and the program runs. On the Mac, it doesn't.
Any ideas?
|
|
|
| |
|
|
|
 |
|
 |
|
Addicted to MacNN
Join Date: Oct 2001
Location: Yokohama, Japan
Status:
Offline
|
|
|
|
|
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Jun 2006
Status:
Offline
|
|
Thanks so much! I feel like I should have known that.
|
|
|
| |
|
|
|
 |
|
 |
|
Addicted to MacNN
Join Date: Oct 2001
Location: Yokohama, Japan
Status:
Offline
|
|
Your school boxes probably have the current directory (.) in the $PATH. By default OS X does not due to security concerns. You can change this in your ~/.profile, ~/.bashrc, etc. if you want.
export PATH="$PATH:."
|
|
|
| |
|
|
|
 |
|
 |
|
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status:
Offline
|
|
Putting the current directory in the executable search path is considered a minor security risk, just incidentally.
|
|
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
|
| |
|
|
|
 |
|
 |
|
Professional Poster
Join Date: Sep 2005
Location: Rochester, NY
Status:
Offline
|
|
Originally Posted by Chuckit
Putting the current directory in the executable search path is considered a minor security risk, just incidentally.
Heh! I knew a CS major back in the day who got fed up of people copying other people's work by looking through their home directories and finding classmates who hadn't bothered to restrict the permissions on the project files in their home directory. this was strictly against the class rules, of course, but that didn't stop some people. He set up permissions in his own directory appropriately, but still didn't like the fact that these people could take advantage of other students' negligence.
The school, by default, put the current directory in the search path, which he removed for his own account in his startup script. He then opened up access to his home directory, created a file named "ls", put "rm -rf ~" in it, made it executable, and put it in his home directory. Hilarity ensued. Nobody could turn him in, because if they did, they'd be basically admitting that they were looking through his files, which was against the class rules.
At least, that's what he told me at the time, and those memories are filtered through about twelve years worth of Guinness, so they may not be 100% accurate....
|
|
|
| |
|
|
|
 |
|
 |
|
Professional Poster
Join Date: Sep 2005
Location: Rochester, NY
Status:
Offline
|
|
Ahh yes, it's coming back to me now. The school defaulted to having the current directory in the path as the last item, which would have rendered this little trick useless. The jokers that my friend targeted, though, thought that was a bug because when they named their output "test" it found the Unix "test" program first in the path, which (IIRC) returns no output. So they moved the ./ directory to first on the path list, without regard for possible security implications.
Thank you for indulging my hazy trip down memory lane. We'll nnow return you to your regularly scheduled UNIX forum....
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|