0

I am running Ubuntu. Please advise where I should enter the command to compile the C++ program that I have entered in gedit. Please also advise if I need to relocate the C program before trying to compile and run it, and where I should relocate it.

1

Save the file somewhere as program.cpp then open a terminal and cd to the directory you saved the file.

To compile the program with gcc run gcc -o program program.cpp. If there are no errors in the program this will output a binary with your compiled program called program which you can run with ./program in the terminal.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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