• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Compiling a C program in Redhat 8.0

Yohhan

Senior member
Trying to compile a C program in linux (redhat 8.0). I type:

$ cc helloworld.c

and it compiles and puts "a.out" in the same directory. However, when I try to run the program by typing:

$ a.out

I get the error message:
-bash: a.out: command not found

Any ideas why that would happen? When I list the directory, "a.out" is highlighted in green, which I'm pretty sure means it's an executable. Why does it give me the error?

Thanks ahead.
 
try ./a.out

basically its not in your executable path, so the ./ makes it execute in the current directory
 
... or you can change your $PATH environment variable to include '.' ... This is somewhat frowned upon (for security reasons), but if you must do it, put '.' at the very end of the list....
 
Back
Top