Compiling using g++ and xCode

I am still trying to compile a C++ program properly using terminal and xcode. I found this link here on how to compile: http://www1.cmc.edu/pages/faculty/alee/g++/g++_mac.html

I already have xcode installed with the command line tools. However, when I enter the code

g++ -g hello.cpp -o hello -lm

in the terminal to make it compile, it says

xcrun: Error: failed to exec real xcrun. (No such file or directory).

May I know what is happening? The file is saved in desktop and I did cd ~ then cd desktop in the terminal, then typed the g++ -g hello.cpp -o hello -lm code, but there is still an error. Please see the dropbox image.

Also, do you happen to know why the file in the Xcode sidebar is called hello.cp when I first did it?

https://www.dropbox.com/sh/ghew8r5fbi7j23f/AADvmwp6akUY2ZKh_p6LjjM7a?dl=0

Thank you!
What version of XCode did you install?

Normally you shouldn't try to directly invoke a compiler that is bundled with an IDE, you should just use the IDE and tell it to build and run your project. If you have issues, uninstall and reinstall.
Topic archived. No new replies allowed.