Xcode as a basic IDE to learn C/C++?

I'm interested in learning C/C++, from nearly scratch, and I realize that I need an IDE on my Yosemite Macbook for coding practice.


I've installed Xcode 6.4. When I start it, it offers me a choice of creating a playground or project. For rudimentary programming practice, what do I need to do? Obviously I'm not developing these as OS X or iOS apps, just practice exercises.


Alternatively, I gather that I could install another IDE such as the GNU compiler or one like Eclipse, but unless it introduces extra complications it seemed as though Xcode would be a straightforward way to go. Thanks for any suggestions on getting started.

Posted on Sep 9, 2015 6:46 PM

Reply
3 replies

Sep 10, 2015 3:36 AM in response to FrankO23

Playgrounds are only for Swift (Apple new language) so not of interest for C/C++ coding.


Create a project, select OSX > Application > Command Line Application or use use the compiler directly via the command line (Terminal). For command line usage use the 'clang' command - it's mostly compatible with gcc, so most mac/linux/unix command line C/C++ tutorials should be usable.

Sep 10, 2015 5:12 AM in response to FrankO23

When you install Xcode, it has Terminal command line compilation tools contained within the Xcode application bundle. Apple no longer provides GNU compiler technology, and has moved forward with the more modernly efficient clang/llvm tools. Although gcc/g++ remain, they are not GNU compilers. To get at the Xcode compilation tools directly in the Terminal, you need to preface your compilation line as follows:

xcrun clang++ -Wall -O2 -o fib_memo fib_memo.C -stdlib=libc++ # also -std=c++11 if using those extensions in your code

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Xcode as a basic IDE to learn C/C++?

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