Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

terminal is not working for 'c' and 'c ' programs

my macbook pro early 2015 os X 10.10.2 and i have a problem with my terminal as i am student i need it to compile all programs but i am not able to do that for programs like 'c' and 'c++' and also python

MacBook Pro with Retina display, OS X Yosemite (10.10.2)

Posted on Jul 22, 2015 10:11 AM

Reply
Question marked as Best reply

Posted on Jul 22, 2015 10:24 AM

Have you downloaded Xcode?

3 replies

Jul 22, 2015 10:35 AM in response to repala

Grab Xcode from the App store then install the command line tools, either via this in Terminal…

xcode-select --install

or by using the Xcode menu 'Open Developer Tool > More Developer Tools' to select & install them



Python shouldn't need compiling & I think it is included by default so you may have something setup badly if you cannot do 'python --version' in Terminal.

Jul 22, 2015 2:37 PM in response to repala

Python is installed by the operating system, but C and C++ compilation tools are installed via the OS X Command Line tools, which can operate independent of Xcode. You download these from here, once you have signed up for a free developer account using your Apple ID and password.


User uploaded file


The compiler you will be using is Clang and Clang++. Expect strong type checking, so if you are learning from a K & R book, you are in for a surprise.


A typical C++ compilation line depending on the degree of C++11 and regular C++ that you use. The following program imports iostream, locale, and map protocol because I wanted to simulate key/value pairs. This was compiled on OS X 10.10.4.


clang++ -Wall -O2 -o fib_memo fib_memo.C -std=c++11 -stdlib=libc++


Resist any temptation to modify the current Python installation in OS X, because if you screw it up, you will have to reinstall Yosemite to get it back to original. If your classwork calls for a Python 3 interpreter, then use the homebrew package manager to install the latest. It won't step on your system Python.

terminal is not working for 'c' and 'c ' programs

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.