Learning Xcode for Mac Users Wanting to Compile C++ Programs

  • Context: C/C++ 
  • Thread starter Thread starter 00PS
  • Start date Start date
Click For Summary

Discussion Overview

The discussion revolves around the challenges and guidance for Mac users transitioning from Windows to using Xcode for compiling C++ programs. Participants share their experiences and seek advice on navigating the Xcode environment and compiling C++ code.

Discussion Character

  • Exploratory
  • Technical explanation
  • Conceptual clarification

Main Points Raised

  • One participant expresses intimidation by Xcode's developer tools and seeks help specifically for compiling C++ programs, not for learning C++ itself.
  • Another participant mentions that Xcode installs GCC, the Mac OS X compiler, and provides a command-line method to compile C programs using Terminal.
  • A question is raised about the difference between the source file name and the output program name in the context of compilation.
  • A participant explains that Unix compilers default to naming the output executable a.out and describes how to specify a different name using the "-o" option.
  • Advice is given on creating a standard C++ class by starting a new project in Xcode, with references to the Xcode manual for guidance.
  • Another participant reiterates the complexity of Xcode but reassures that it becomes easier to use over time, comparing it to MinGW on Windows.
  • A recommendation is made for a book on Cocoa Programming for Mac OS X as a resource for learning Xcode and application development.

Areas of Agreement / Disagreement

Participants generally agree on the usefulness of Xcode for C++ development but express varying levels of comfort and familiarity with the environment. There is no consensus on the best approach to learning Xcode or the necessity of using the manual.

Contextual Notes

Some participants mention specific versions of Xcode, which may affect the features and user interface discussed. There are also varying levels of experience with C++ and Xcode among participants, which may influence their perspectives.

Who May Find This Useful

Mac users transitioning from Windows who are looking to compile C++ programs using Xcode, as well as those seeking resources for learning the Xcode environment.

00PS
Messages
30
Reaction score
0
So I took C and C++ classes in high school, and can remember most of it, but all of that was under Windows (devC++ to be exact). After switching to a mac in college I recently download Xcode and was a little intimidated with all the "developer tools". I don't really plan to use that stuff any time soon, but wanted a C++ compiler that runs native on macs. Anyways can I get some help on getting started and just compiling written programs. Like I said no help needed with the C++ just the environment. Thanks!
 
Technology news on Phys.org
If you've installed XCode, then XCode has already covertly installed GCC, which is the Mac OS X compiler. If you want to use GCC without bothering with XCode, just open a new window in Terminal and say

gcc filename.c -o programname

to compile filename.c, then say

./programname

to run it.
 
what is the difference between filename.c and programname.c?
 
By default unix compilers generate an output executable called a.out (for historic reasons) rather than filename.exe on a dos machine.
You can tell gcc what to call the output executable with the "-o name" command.
When you get to more complicated programs you might have 100s of .c files so you have to tell the system what you want the output to be.
 
If you want to create a standard C++ class, create a new project that is a tool which is a C++ file. There's descriptions there. There's also the XCode manual that you can refer to which basically tells you which project to choose.

It's complex-looking at first, but XCode isn't that hard to use after awhile.

It's a great IDE, and this is coming from MinGW on the Windows platform.
 
BryanP said:
If you want to create a standard C++ class, create a new project that is a tool which is a C++ file. There's descriptions there. There's also the XCode manual that you can refer to which basically tells you which project to choose.

It's complex-looking at first, but XCode isn't that hard to use after awhile.

It's a great IDE, and this is coming from MinGW on the Windows platform.

I'm sorry, can you be more specific? I am using Xcode 3.1 if that is any consolation. :)
 
I highly recommend Aaron Hillegass's book Cocoa Programming for Mac OS X to learn how to use XCode and how to develop Mac applications.
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
4K
Replies
6
Views
3K
  • · Replies 29 ·
Replies
29
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 8 ·
Replies
8
Views
14K
  • · Replies 6 ·
Replies
6
Views
4K
  • · Replies 13 ·
Replies
13
Views
31K
Replies
4
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 15 ·
Replies
15
Views
5K