• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 188
  • Last Modified:

How to run home-made programs?

I used g++ to compile a simple "Hello world" C++ program. It produced the "a.out" executable. If I try to run the "a.out" executable, I get "Command not found". How can I run my home-made programs?
0
mariocou
Asked:
mariocou
1 Solution
 
mpassCommented:
The "Command not found" error is because your program is in a directory not located in your path. You can remedy this by adding the directory of the file to your path or just put a './' in front of your executable file. So as long as your file is executable, you can do this "./a.out" (w/o the quotes) and the program should run.

In case your file is not executable, just "chmod 777 a.out"

If you still have problems, please leave a comment. Thanks.
0
 
EatEmAndSmileCommented:
If the ¨.¨ directory is not in your path, you're probably running it as root. This is not recommended.
--------------_4D4800F93F08BFFFEDD4
Content-Disposition: form-data; name="notify"

on
--------------_4D4800F93F08BFFFEDD4
Content-Disposition: form-data; name="Submit"

Submit
--------------_4D4800F93F08BFFFEDD4--
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now