tags:

views:

32

answers:

1
+2  A: 

Use the C++ compiler, not the C compiler.

exec 'g++ j.cpp'

exec will replace the current process, so you may want to use backticks instead.

output = `g++ j.cpp -o "prog" && ./prog`

The output file is specifically named as "prog" just to be more clear on what we are executing.

Anurag
@Anurag :- Thanks. So silly of me. Now that this is solved, can you help me to get the output/ errors encountered in the compilation and process.
Silver Spoon