Launch compiled C++ file from terminal?

Discussion in 'Mac Programming' started by thestaton, Feb 6, 2008.

  1. macrumors 6502

    Jan 19, 2006
    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?

  2. Moderator emeritus


    Jun 15, 2000
  3. thread starter macrumors 6502

    Jan 19, 2006
    thanks. worked like a charm :)

Share This Page