el__sid
October 15th, 2006, 03:21 PM
Hey guys,
Straight to the point: I've just compiled a simple c++ program using g++, and when I open a terminal and try to run it, I can't!
I've placed the resulting executable (named the default a.out) in my home folder, however whenever I use the command "sh a.out" I get the reply:
"a.out: a.out: cannot execute binary file"
I've also tried not giving the file an extension with the -o option, only for the terminal to somehow skip the part where the program runs and bring me straight back to the prompt:S
The only way I've gotten it to run so far is to name the file with the .sh extension and "Run from terminal" by double clicking it, however I'd much rather be able to run it directly from the terminal, which surely must not be that hard considering I'm trying to run a CLI program?
Any way to make CLI programs run from a terminal? or am I doing something wrong?
Straight to the point: I've just compiled a simple c++ program using g++, and when I open a terminal and try to run it, I can't!
I've placed the resulting executable (named the default a.out) in my home folder, however whenever I use the command "sh a.out" I get the reply:
"a.out: a.out: cannot execute binary file"
I've also tried not giving the file an extension with the -o option, only for the terminal to somehow skip the part where the program runs and bring me straight back to the prompt:S
The only way I've gotten it to run so far is to name the file with the .sh extension and "Run from terminal" by double clicking it, however I'd much rather be able to run it directly from the terminal, which surely must not be that hard considering I'm trying to run a CLI program?
Any way to make CLI programs run from a terminal? or am I doing something wrong?