Reply
   
 C compiler 
 
 
  #1 (permalink)  
Old 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
gtext is offline
Profile CardPM
Go to the top of the page
Digg this Post!Add Post to del.icio.us Share on Facebook
Reply With Quote
  #2 (permalink)  
Old 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
__________________
Over 12 million widgets and apps downloaded: iSlayer.com (RSS), iPhone apps: Bjango.com (RSS, Twitter)
TV stuff: IceTV (RSS, IceTV iPhone app)
marc is offline
Profile CardPM
Go to the top of the page
Digg this Post!Add Post to del.icio.us Share on Facebook
Reply With Quote
  #3 (permalink)  
Old 15-06-2008, 12:10 PM
Regular

Join Date: Nov 2007
Group: Regulars
Location: Melbourne
Posts: 293


Quote:
Originally Posted by marc View Post
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
gtext is offline
Profile CardPM
Go to the top of the page
Digg this Post!Add Post to del.icio.us Share on Facebook
Reply With Quote
Huy
  #4 (permalink)  
Old 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.
Huy is offline
Profile CardPM
Go to the top of the page
Digg this Post!Add Post to del.icio.us Share on Facebook
Reply With Quote
  #5 (permalink)  
Old 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
purana is offline
Profile CardPM
Go to the top of the page
Digg this Post!Add Post to del.icio.us Share on Facebook
Reply With Quote
  #6 (permalink)  
Old 15-06-2008, 05:01 PM
Regular

Join Date: Nov 2007
Group: Regulars
Location: Melbourne
Posts: 293


Quote:
Originally Posted by purana View Post
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
gtext is offline
Profile CardPM
Go to the top of the page
Digg this Post!Add Post to del.icio.us Share on Facebook
Reply With Quote
  #7 (permalink)  
Old 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.
__________________
SEARCH MACTALK
Wally is offline
Profile CardPM
Go to the top of the page
Digg this Post!Add Post to del.icio.us Share on Facebook
Reply With Quote
  #8 (permalink)  
Old 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
gtext is offline
Profile CardPM
Go to the top of the page
Digg this Post!Add Post to del.icio.us Share on Facebook
Reply With Quote
  #9 (permalink)  
Old 15-06-2008, 05:17 PM
Regular

Join Date: Jan 2004
Group: Forum Leaders
Location: Sydney
Posts: 4,702


Quote:
Originally Posted by gtext View Post
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
purana is offline
Profile CardPM
Go to the top of the page
Digg this Post!Add Post to del.icio.us Share on Facebook
Reply With Quote
Huy
  #10 (permalink)  
Old 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).
Huy is offline
Profile CardPM
Go to the top of the page
Digg this Post!Add Post to del.icio.us Share on Facebook
Reply With Quote
  #11 (permalink)  
Old 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?!
bennyling is offline
Profile CardPM
Go to the top of the page
Digg this Post!Add Post to del.icio.us Share on Facebook
Reply With Quote
Huy
  #12 (permalink)  
Old 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).

Huy is offline
Profile CardPM
Go to the top of the page
Digg this Post!Add Post to del.icio.us Share on Facebook
Reply With Quote
  #13 (permalink)  
Old 15-06-2008, 05:30 PM
Regular

Join Date: Nov 2007
Group: Regulars
Location: Melbourne
Posts: 293


Quote:
Originally Posted by Huy View Post
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
gtext is offline
Profile CardPM
Go to the top of the page
Digg this Post!Add Post to del.icio.us Share on Facebook
Reply With Quote
Huy
  #14 (permalink)  
Old 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 ).
Huy is offline
Profile CardPM
Go to the top of the page
Digg this Post!Add Post to del.icio.us Share on Facebook
Reply With Quote
  #15 (permalink)  
Old 15-06-2008, 05:53 PM
Regular

Join Date: Nov 2007
Group: Regulars
Location: Melbourne
Posts: 293


Quote:
Originally Posted by Huy View Post
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
gtext is offline
Profile CardPM
Go to the top of the page
Digg this Post!Add Post to del.icio.us Share on Facebook
Reply With Quote
 
Reply

Thread Tools

 
Similar Threads
 
Thread Thread Starter Forum Replies Last Post
C++ Compiler? jastormont Projects: Audio, Graphics, Video, HTPC and Programming 4 30-06-2007 08:21 AM
eprom programmer thephydeaux Peripherals 10 06-09-2006 05:08 PM
C compiler cannot create executables. EugeneG Help and New Mac User Support 1 27-07-2004 08:00 PM