|
|

15-06-2008, 11:47 AM
|
|
Regular
Join Date: Nov 2007
Group: Regulars
Location: Melbourne
Posts: 293
|
C compiler
This may seem a silly question for some of you. Appologies
Not having done any programming before I was looking at some of the c programing websites.
The requirement is a compiler.
In Leopard there is Terminal. Is that suitable, if not what is?
If possible looking at something to start off at no cost.
Just need a bit of guidance here as this is all new to me.
__________________
Mac Pro 2.8GHz 8 core Leopard 10.5.5, Black 16GB iPhone 3G
|
|
|
|
|
|
|
|

15-06-2008, 11:54 AM
|
|
Widgeteer
Join Date: Apr 2005
Group: Forum Leaders
Posts: 5,368
|
Xcode comes with OS X and is part of the developer tools. Just install it and you'll be ready to rock.
Tools - Xcode
|
|
|
|
|
|
|
|

15-06-2008, 12:10 PM
|
|
Regular
Join Date: Nov 2007
Group: Regulars
Location: Melbourne
Posts: 293
|
Quote:
Originally Posted by marc
Xcode comes with OS X and is part of the developer tools. Just install it and you'll be ready to rock.
Tools - Xcode
|
Great. Thanks marc for leading me in the right direction there.
For anyone else that responds I won't ignore you. Going out for a while. I'll check in later.
__________________
Mac Pro 2.8GHz 8 core Leopard 10.5.5, Black 16GB iPhone 3G
|
|
|
|
|
|
|
|

15-06-2008, 12:24 PM
|
|
It's a cruel, cruel summer
Join Date: Jul 2005
Group: Regulars
Location: NSW
Posts: 5,163
|
Yep Xcode Tools will install what you need.
And then from the command line (Terminal) you can gcc and away you go.
|
|
|
|
|
|
|
|

15-06-2008, 12:24 PM
|
|
Regular
Join Date: Jan 2004
Group: Forum Leaders
Location: Sydney
Posts: 4,702
|
As indicated, install Xcode. It contains the gcc compiler as used on Linux and various other unix platforms.
__________________
MacBook 2.4Ghz C2D Superdrive w/ 4Gb ram, 160Gb HDD (White)
iMac 20" 2.16Ghz C2D w/ 3Gb ram, 256Mb video ram (White)
iPhone 3G 8Gb
1Tb Time Capsule
|
|
|
|
|
|
|
|

15-06-2008, 05:01 PM
|
|
Regular
Join Date: Nov 2007
Group: Regulars
Location: Melbourne
Posts: 293
|
Quote:
Originally Posted by purana
As indicated, install Xcode. It contains the gcc compiler as used on Linux and various other unix platforms.
|
Installed Xcode. Just don't understand the gcc bit and terminal.
Opened terminal. Typed in gcc. and nothing. Is that what I'm meant to do?
__________________
Mac Pro 2.8GHz 8 core Leopard 10.5.5, Black 16GB iPhone 3G
|
|
|
|
|
|
|
|

15-06-2008, 05:04 PM
|
|
King of the Carrot Flowers
Join Date: Feb 2005
Group: Regulars
Location: Gippsland, Victoria
Posts: 2,002
|
gcc should come up with
gcc: no input files
There is an extras pack to install with the Xcode part if i remember correctly.
|
|
|
|
|
|
|
|

15-06-2008, 05:07 PM
|
|
Regular
Join Date: Nov 2007
Group: Regulars
Location: Melbourne
Posts: 293
|
Nothing was the wrong terminology.
Should have said "i686-apple-darwin9-gcc-4.0.1: no input files".
__________________
Mac Pro 2.8GHz 8 core Leopard 10.5.5, Black 16GB iPhone 3G
|
|
|
|
|
|
|
|

15-06-2008, 05:17 PM
|
|
Regular
Join Date: Jan 2004
Group: Forum Leaders
Location: Sydney
Posts: 4,702
|
Quote:
Originally Posted by gtext
Nothing was the wrong terminology.
Should have said "i686-apple-darwin9-gcc-4.0.1: no input files".
|
gcc is a compiler, and it will compile blah.c source files. Your expected to code your program in c and then compile it. I wouldn't worry about gcc just yet, as you seriously need to code in c first.
What are you hoping to do with a gcc compiler installed anyways? Learn to code??
__________________
MacBook 2.4Ghz C2D Superdrive w/ 4Gb ram, 160Gb HDD (White)
iMac 20" 2.16Ghz C2D w/ 3Gb ram, 256Mb video ram (White)
iPhone 3G 8Gb
1Tb Time Capsule
|
|
|
|
|
|
|
|

15-06-2008, 05:17 PM
|
|
It's a cruel, cruel summer
Join Date: Jul 2005
Group: Regulars
Location: NSW
Posts: 5,163
|
Well if you want to compile some C program, then you'd have to put in some flags and the source code gtext.
e.g.
gcc -Wall -W -ansi -pedantic -g myProgram.c
Then to execute
./a.out
Write your program. Save it as a .c file and then compile, run it. Debug if necessary. Rinse and repeat.
Type man gcc in Terminal to find out more about gcc and what flags are available (parameters).
|
|
|
|
|
|
|
|

15-06-2008, 05:21 PM
|
|
Regular
Join Date: Dec 2007
Group: Regulars
Location: Hobart, TAS
Posts: 1,032
|
To get you started:
Long Pointers XCode 3.0 Tutorial
Cocoa Dev Central: C Language Tutorial for Cocoa
What exactly did you want to do anyway?! Learn to program Cocoa apps? Learn C? Learn Objective-C?!
|
|
|
|
|
|
|
|

15-06-2008, 05:23 PM
|
|
It's a cruel, cruel summer
Join Date: Jul 2005
Group: Regulars
Location: NSW
Posts: 5,163
|
I think he just wants to test out some C programs and start coding simple stuff like getting Hello World to run (for a start).

|
|
|
|
|
|
|
|

15-06-2008, 05:30 PM
|
|
Regular
Join Date: Nov 2007
Group: Regulars
Location: Melbourne
Posts: 293
|
Quote:
Originally Posted by Huy
I think he just wants to test out some C programs and start coding simple stuff like getting Hello World to run (for a start).

|
Correct.
Just trying to find out what program to start with. What to enter the code into.
c programming that is.
__________________
Mac Pro 2.8GHz 8 core Leopard 10.5.5, Black 16GB iPhone 3G
|
|
|
|
|
|
|
|

15-06-2008, 05:40 PM
|
|
It's a cruel, cruel summer
Join Date: Jul 2005
Group: Regulars
Location: NSW
Posts: 5,163
|
At uni, they made us learn the 'hard' way.
That is, regular old text editor in UNIX and doing everything via the command line (Terminal, xterm, shell, console, whatever you want to call it!).
I suggest you use something like nano, pico to start off with (they are command line text editors). If you want to be 'hardcore' then you can start learning vi/vim.
Then you can use the above gcc compiler to compile and run your programs. It is a good feeling when it compiles (free from error) and you have a little program that works.
There are plenty of guides online, books, etc that you can use to start off on the path to programming. And there are people online who will help you out if you are having some trouble/don't understand something.
So you can punch in something like this:
Quote:
#include<stdio.h>
main()
{
printf("Hello World");
}
|
into your text editor and then compile it (save the file first  ).
|
|
|
|
|
|
|
|

15-06-2008, 05:53 PM
|
|
Regular
Join Date: Nov 2007
Group: Regulars
Location: Melbourne
Posts: 293
|
Quote:
Originally Posted by Huy
At uni, they made us learn the 'hard' way.
That is, regular old text editor in UNIX and doing everything via the command line (Terminal, xterm, shell, console, whatever you want to call it!).
I suggest you use something like nano, pico to start off with (they are command line text editors). If you want to be 'hardcore' then you can start learning vi/vim.
Then you can use the above gcc compiler to compile and run your programs. It is a good feeling when it compiles (free from error) and you have a little program that works.
There are plenty of guides online, books, etc that you can use to start off on the path to programming. And there are people online who will help you out if you are having some trouble/don't understand something.
So you can punch in something like this:
into your text editor and then compile it (save the file first  ).
|
Thanks Huy for that help. I've got something now to get me started.
Now I understand the sequence - write then compile.
I was thinking that the compiler was what I wrote the code into. Got it totally wrong there.
Thank you everybody for your help.
__________________
Mac Pro 2.8GHz 8 core Leopard 10.5.5, Black 16GB iPhone 3G
|
|
|
|
|
|