PDA

View Full Version : C++ Compiling Problems



BrandonND
March 31st, 2009, 04:16 AM
I made a simple Hello World Script, as a *.cpp file. I sed the following command

g++ <source file> -o <desired output>

but the file I get I cant run for the life of me, how can I get it to run?

krazyd
March 31st, 2009, 04:38 AM
Have you tried
./<desired output>

Also, usually the g++ command is given with the -o option first and sources last eg:


g++ -o <desired output> <source file1> <source file2>

sujoy
March 31st, 2009, 05:55 AM
nope, -o works on either side of input source files.

zjagannatha
March 31st, 2009, 06:34 AM
g++ -o <output> <source1> <source2> ...
g++ <source1> <source2> ... -o <output>

Both will compile just fine.

TheBuzzSaw
March 31st, 2009, 07:43 AM
Try typing this:

./a.out

dwhitney67
March 31st, 2009, 11:09 AM
I made a simple Hello World Script, as a *.cpp file. I sed the following command

g++ <source file> -o <desired output>

but the file I get I cant run for the life of me, how can I get it to run?
Show us the program, and show the result of attempting to compile it.