compiling with command prompt

Can someone please explain how to compile with this command:
g++ program.cpp -o program

I'm not sure how to use it and what needs to be written before that in command prompt.

thanks!
Are you using linux?
If so, then if GCC is installed that is the command you should run in your terminal window while current dirrectory contains your program.cpp
oh, sorry, I'm using windows xp
Use the Command Prompt. You can find it under Accessories in the start menu somewhere. Another way is to press Flag key+R, type cmd and then press enter.

This will show a black window that you can type the command into. If program.cpp is not in the current folder you will have to use the cd command to navigate to the correct folder before running the compiler command.

cd path/to/program/folder/
g++ program.cpp -o program
Last edited on
After I do that I get this:

'g++' is not recognized as an internal or external command, operable program or batch file
Is the directory containing g++ in your PATH environment variable?
Have you installed the compiler?
Last edited on
Yes, I have MinGW.
I used a set path command, now when I write "g++ program.cpp -o program" nothing happens
Thats presumably because it worked. There should now be a program.exe inside the folder: Run it from the command prompt.
:O
it worked!
thank you all so much :D
Topic archived. No new replies allowed.