You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

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

Can Xcode be used as c++ compiler?

I am wanting to start to do some c++ programming. Does Xcode have to facilities to be able to write basic code and compile it?if so, how do you create a blank project and then compile?

MacBook Pro

Posted on Oct 9, 2014 5:35 AM

Reply
Question marked as Top-ranking reply

Posted on Oct 9, 2014 5:53 AM

Yes

Xcode > File > New > Project > Command Line Tool > Next > Language -> C++


You can also freely add C++ files to any other kind of project too. If you do that, you would be responsible for jumping through the linking hoops.

7 replies

Oct 10, 2014 5:45 AM in response to nuttsy_5

I'm sorry. I don't know what you are asking. "build menus to choose from?"


Xcode is optimized for building apps, not doubt about it. If you want to build programs entirely on the command line, you can still do that with the command line tools. If you build from within the Xcode debug environment, you have to interact via the little debug window. It works fine for the most part. You can run a built program directly in the command line but you would probably have to "archive" it first to export it out of the Xcode environment.


If you are still learning, I strongly suggest just using the command line. You could use Xcode as just a text editor, although it isn't particularly good at that. There are many other text editors available. TextWrangler is a popular one. Again, if you are learning, then vi is a good skill to learn. Once you get more than one source file, you may want to start writing makefiles. If things get really complicated, then you probably want to go back to Xcode, but then you are back at square one with Xcode's convoluted environment.


Unfortunately, Apple makes no allowances for people trying to learn, especially something like C++. If you want to do everything the "Apple way" then you would use the Swift Playground. But if you want C++, then Apple is just going to kick you back to 1994.

Can Xcode be used as c++ compiler?

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