GIDForums  

Go Back   GIDForums > Computer Programming Forums > C Programming Language
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 06-Mar-2005, 22:51
tahum tahum is offline
New Member
 
Join Date: Mar 2005
Posts: 2
tahum is on a distinguished road

Programming C with Xcode...plz help


ok, I'm about 20 seconds from dropping this whole f**king C programming cuz I cant get it to work. I'm running on an ibook G4, Panther 10.3.8.


Now, I started with the simple "Hello, World" program (which i cant get to work). At first, I tried writing the program in the terminal itself which game me a syntax error whenever I wrote: "printf("hello, world\n);". I understood that I had to write the program in a text editor and save it as "hello.c".

My questions are:

#1 - In what text editor can I write this program
#2- How in the WORLD do I compile it !!!!!!!
#3- After compiling it, how do I run it in the terminal


I installed Xcode and understood how to write a code for C, but after I save the code, what do i do????????????????

Sorry if i sound kinda pissed, but i really am determined to learn C but I had a sorta rough start. If you would be nice enough to give me somewhat of a step by step guide to accompish this "Hello World" drama going on in my life.

I really appreciate your help and ur time,

Sincerely,

Mike
  #2  
Old 06-Mar-2005, 23:36
WaltP's Avatar
WaltP WaltP is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Midwest US
Posts: 3,335
WaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to all
Quote:
Originally Posted by tahum
My questions are:

#1 - In what text editor can I write this program
Any text editor. Honest.

Quote:
Originally Posted by tahum
#2- How in the WORLD do I compile it !!!!!!!
What C-compiler do you have installed? If you don't have one, you need to get one. I don't know what's available for iBook.

Quote:
Originally Posted by tahum
#3- After compiling it, how do I run it in the terminal
Depends entirely on what compiler you install.

Quote:
Originally Posted by tahum
I installed Xcode and understood how to write a code for C, but after I save the code, what do i do????????????????
Don't know what Xcode is.
__________________

During the election they said Obama could only be elected when pigs fly. Well, we currently have an epidemic of Swine Flu. Coincidence?
  #3  
Old 07-Mar-2005, 01:59
LuciWiz's Avatar
LuciWiz LuciWiz is offline
Moderator
 
Join Date: Jul 2004
Location: Cluj-Napoca (Romania)
Posts: 1,032
LuciWiz is a jewel in the roughLuciWiz is a jewel in the roughLuciWiz is a jewel in the roughLuciWiz is a jewel in the rough
I never heard of Xcode before, but I ran a little search and it seems to be an all-in-one IDE (C, C++, Java - the works) for MacOS. I don't own a Mac, so I'll just give you a link Apple Malaysia.

It seems to have nice GUI. It even has a Build and Go button - that should build your program and run it.
I'm sorry if you have a different version. Also, I have no idea on how to run it in the terminal. Maybe someone with a Mac...

Kind regards,
Lucian
__________________
Please read these Guidelines before posting on the forum

"A person who never made a mistake never tried anything new."
Einstein
  #4  
Old 07-Mar-2005, 06:44
Qchem Qchem is offline
New Member
 
Join Date: Mar 2005
Posts: 1
Qchem is on a distinguished road
As mentioned you can use any text editor. I personally use emacs but that may be a little heavy for you as a beginner. Try using textedit.

To compile from the terminal

gcc -o nameofoutput nameofinput.c

and then to run the program type

./nameofoutput
  #5  
Old 07-Mar-2005, 11:57
crystalattice's Avatar
crystalattice crystalattice is offline
Aspiring author
 
Join Date: Apr 2004
Location: Japan (again)
Posts: 1,628
crystalattice is just really nicecrystalattice is just really nicecrystalattice is just really nicecrystalattice is just really nicecrystalattice is just really nice
I'm not physically near my Mac (being 1/2 way across the country from it) but from what I recall, after you've written your program, the "Build and Go" button should build, compile, and run your program. A new window will pop up w/ the output.

Once you've compiled the program, you be able to run it in Terminal like any other program; go to the directory you saved it in and execute the program. Alternatively, there should be an icon where you saved it that should run when you click it.

XCode should give you a basic "Hello World" app when you first run it; if you compile this, you should have no problem. The "Help" menu has a great walkthrough for building apps in XCode; I was able to write a short program and get it running pretty quickly while having the Help window open next to my code.
__________________
Start Programming with Python-A beginner's guide to programming and the Python language.
-------------
Common Sense v2.0-Striving to make the world a little bit smarter.
 
 

Recent GIDBlogAccepted for Ph.D. program by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Read/ Write EXCEL files using C/C++ programming confused_pig C++ Forum 4 25-Nov-2005 01:27
[Tutorial] GUI programming with FLTK dsmith FLTK Forum 10 03-Oct-2005 16:41
Graphics programming with TIFF file format confused_pig C Programming Language 1 10-Jan-2005 08:53
GUI programming crystalattice C++ Forum 5 14-Sep-2004 13:17

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 17:04.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.