Here's how I do it: g++ -o executable_name source_code.cpp
That should compile it. I personally have that all set up into a script so it
takes less time to type. Put
#!/bin/bash
g++ -o $1 $1.cpp; ./$1
into a text file, like "compile", chmod it (chmod u+x compile), and move it
in your path, like /usr/local/bin. Then to compile a program you wrote, just
type "compile program_name" and it'll compile and run it automatically. And as
far as I know, all compilers work the same way.
>
> hey, this is an easy question:
> How do I compile a program under g++
> I just can't figure it out
> lets say, I have a file called "test.cpp" under / the dir
> how would I compile it?
> when i try, it does not return anything on the command line
> and just makes a new command line, just like when i started!
> also, do all the compilers work the same way? ie - gcc, etc.
>
> Thanks,
> Julien
--
Anthony Huereca
http://m3000.1wh.com
Press any key to continue and any other key to quit