PDA

View Full Version : Newbie: Getting started in C




pusman83
Jan 13, 2008, 11:59 PM
Hello,

I'm just getting started in programming and I have to start with C. How do I get a C editor/compiler working on my Mac?

I downloaded xCode today but I'm a bit lost... :o

Thanks!



numero
Jan 14, 2008, 01:05 AM
Run the installer for Xcode if you haven't done that already.

Since you are just starting out I am going to assume that you are either in a class or have some book to learn from. Most people start with command line programs. Here's how you get one setup.

Run Xcode. /Developer/Applications/Xcode

Create a new project. File / New Project

Create a standard command line project. Open the Command Line Utility triangle and select Standard Tool.

Give your project a name and place to be saved to.

That's it. You are now ready to edit the main.c file.

toddburch
Jan 14, 2008, 06:09 AM
Visually, here's what you pick.

Todd

Darkjenso
Jan 14, 2008, 09:49 AM
is it just me, but does the xcode documentation on the apple site for the previous version?

Cromulent
Jan 14, 2008, 10:50 AM
is it just me, but does the xcode documentation on the apple site for the previous version?

Depends which version documentation you are looking at :). Obviously the old tutorials will be based on IB 2 but there is new documentation included with Xcode 3 for all the new tools.

pusman83
Jan 14, 2008, 06:19 PM
Thanks! :D

I didn't want to be coding on an old P3 laptop we have lying around...

Can I compile to .exe from the Mac?

toddburch
Jan 14, 2008, 06:41 PM
From XCode... I don't think so.

If you have bootcamp or parallels, and have Windows installed, you could download Visual C/C++ Express for free and compile on the Windows side though.

Todd

harrymohan
Jan 14, 2008, 08:32 PM
when u r done writing code, do Build and then goto Terminal of Mac and goto the path where u created this file then do this
bash>g++ filename.c
it will compile, if the output is on console
bash>./a.out

u will see output on terminal

Cromulent
Jan 15, 2008, 01:49 AM
Thanks! :D

I didn't want to be coding on an old P3 laptop we have lying around...

Can I compile to .exe from the Mac?

You can but you would need to build your own cross compiler from the GCC source.