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?
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.