Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

1 Answer 1

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.