简体   繁体   中英

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM