PDA

View Full Version : Launch compiled C++ file from terminal?




thestaton
Feb 6, 2008, 03:59 PM
Forgive my ignorance.

I'm new to the programming world, but am progressing pretty quickly.

Right now after I write my program I'm using the terminal to compile the program using...

g++ programname.cpp -o programname.

Everything works great. however I have to go to the folder that the file is in and double click it, in order for it to run.

I've tried using the manual command from the terminal...

programname ; exit;

However I'm getting invalid command.

So is there a way to go on and launch the file from the terminal to save a step?

Thanks.



kainjow
Feb 6, 2008, 04:01 PM
Try ./programname

thestaton
Feb 6, 2008, 04:13 PM
Try ./programname

thanks. worked like a charm :)