Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

To avoid the inevitable, let me put this in context. I am instructing an Intro to Unix course this semester and the students are using Knoppix 6.4.3 off the LiveCD. They are not required to install the system to their hard drive, and I would like to not require them to, however they do have use of a USB flash drive. This version of Knoppix seems to include gcc, but NOT g++. The course curriculum requires compiling C++ programs. I know I can run:

sudo apt-get update sudo apt-get install build-essential

to install (among other things) g++, but of course this only makes sense on a system installed to a hard drive.

So my question is, can I write a script that calls gcc with appropriate options and flags to compile a C++ program that students could use in place of g++?

share|improve this question
up vote 0 down vote accepted

If I understand you right, you're hoping to compile C++ using plain gcc.

I'm afraid that's not going to be possible. C and C++ are two very different languages with many things in C++ that C knows nothing about.

You will require the c++ executable to be able to parse the C++ files, plus of course all the C++ header files ( etc) that are not available with plain C.

share|improve this answer
that's what I was afraid of. And I didn't even think about the absense of the header files. Ok, I'll just have to figure out another solution then. Thanks. – HazyBlueDot Feb 28 '11 at 22:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .