I am new to c++ and I am using visual c++ express edition. I am spending quite a lot of my time doing excercises and am using the command line to compile them.

I have now reach the stage where I am seperating the header files and the .cpp files of a class before creating a second .cpp file which includes function main. But the normal command line compiling (i.e. cl /EHsc program.cpp) does not work when interfaces (h) and implementations (.cpp) are seperate.

Does anyone know how to compile a header, .cpp and program using the command line of visual c++ express?

you don't compile header files, only *.cpp and *.c files. you can list all the *.cpp files on the same line if you want or compile and link them separately.

Doing this from the command line is messy, but feasable. You have to learn all the switches -- there are a lot of them, but you don't have to know them all at once.

you can also create a makefile which contains all the compiler and linker commands. makefiles can get somewhat complex and you can find more about them by using google or searching microsoft.com.

The easiest way to do all that is using the compiler's IDE, which will correctly compile and/or generate the makefiles for you.

This question has already been answered. Start a new discussion instead.