ADARSH A K
ADARSH A K

Reputation: 19

how to compile c++ program in mac terminal

i wrote a program in my mac using sublime text as the plateform..

    #include<iostream>
    using namespace std;
    int main()
        {
        cout<<"HELLOW WORLD";
        return 0;
        }

this was my program.. i saved it in desktop as hellow.cpp

while compiling on mac terminal as g++ hellow.cpp, i found an error

adarshs-MacBook-Air:Desktop adarshak$ g++ hellow.cpp
xcrun: error: invalid active developer path 
(/Library/Developer/CommandLineTools), missing xcrun at: 
/Library/Developer/CommandLineTools/usr/bin/xcrun

anyone plese help me to find out the error

Upvotes: 0

Views: 5820

Answers (1)

pmdj
pmdj

Reputation: 23428

It sounds like you don't have the command line developer tools installed. Run this command from Terminal once:

xcode-select --install

This will bring up the download & installation UI. Follow this through to the end. (It may take a while depending on the speed of your internet connection.)

From then on compiling should work.

Upvotes: 3

Related Questions