Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Aug 3, 2007, 10:44 PM   #1
designbot
macrumors newbie
 
Join Date: Aug 2007
Help an XCode newbie!

I'm learning to program using Stephen G. Kochan's book, Programming in Objective-C. I don't like terminal-based text editors like vi, so I'm using XCode to write & compile my programs. So far so good.

As I go through the book, I will be writing many very small programs. Do I need to create a whole new project in XCode for each one, with a separate folder and everything? Does each code file need to be named "main.m"? I'm sure there's a better way. I'd like to have a folder on my hard drive for each chapter, with a separate file saved for each exercise, something like "exercise2.1.m". Is this possible?

I also have TextMate, so if there's a simple way to accomplish the same thing with that, and easily compile the programs using gcc or something, that would be fine too.

If this is a stupid question, go easy on me; I'm new to this Objective-C stuff.
designbot is offline   0 Reply With Quote
Old Aug 4, 2007, 12:26 AM   #2
mduser63
macrumors 68040
 
mduser63's Avatar
 
Join Date: Nov 2004
Location: Salt Lake City, UT
Send a message via AIM to mduser63
Too tired to post a detailed reply right now, but here are the basics. You don't strictly need to create a new project for each program, but it's easier that way, trust me. Even when not using XCode, I always have a separate folder for each project/program I'm writing. For the simple programs in Kochan's book (single source files IIRC) XCode is probably overkill anyway. TextMate does have the ability to compile source code you're editing, but I've not used that feature much, so all I can say is you need to read the help and figure it out. When you move on to Cocoa, you'll have many source files in the same project/program and XCode's project management features become very helpful, so learning XCode now is probably not a bad idea.

Good luck, and enjoy learning to write software on the Mac. I've been learning for about 2 years now, and while I have an app that's out there with lots of people using it, I still enjoy learning new Cocoa stuff all the time.
mduser63 is offline   0 Reply With Quote
Old Aug 4, 2007, 08:59 AM   #3
Littleodie914
macrumors 68000
 
Littleodie914's Avatar
 
Join Date: Jun 2004
Location: Rochester, NY
I would create separate projects, if I were you.

That's the easiest way to do it, for example, create a folder called "My Cocoa Programs," and save all of your projects in that folder. For example:

My Cocoa Programs -> Exercise 2.1 -> Exercise21.xcodeproj

My Cocoa Programs -> Exercise 3.6 -> Exercise36.xcodeproj

And yes, for many terminally-ran tools, you will begin by executing code in the main.m file. Think of it as the "index.html" of code files. When you get into developing GUI apps, you don't modify the main.m, since it will just start your other code files running.
Littleodie914 is offline   0 Reply With Quote
Old Aug 4, 2007, 11:10 AM   #4
designbot
Thread Starter
macrumors newbie
 
Join Date: Aug 2007
OK, guess I'll just make new projects for each one then.

I tried compiling from TextMate, but it just uses XCode to compile, so it works basically the same.

Thanks, everybody!
designbot is offline   0 Reply With Quote
Old Aug 4, 2007, 07:40 PM   #5
DHagan4755
macrumors 6502a
 
Join Date: Jul 2002
Location: Massachusetts
Just out of curiosity, what types of applications are you guys interested in writing (you don't have to give away ideas, just in general)?
DHagan4755 is offline   0 Reply With Quote
Old Aug 4, 2007, 11:47 PM   #6
mduser63
macrumors 68040
 
mduser63's Avatar
 
Join Date: Nov 2004
Location: Salt Lake City, UT
Send a message via AIM to mduser63
Quote:
Originally Posted by DHagan4755 View Post
Just out of curiosity, what types of applications are you guys interested in writing (you don't have to give away ideas, just in general)?
I like to wrrite stuff that I see a use for myself. If it's helpful to other people, fine, but I think it's best to write something that you'll actually use. And you should certainly use anything you write.
mduser63 is offline   0 Reply With Quote
Old Aug 5, 2007, 03:59 AM   #7
Soulstorm
macrumors 68000
 
Soulstorm's Avatar
 
Join Date: Feb 2005
Quote:
Originally Posted by DHagan4755 View Post
Just out of curiosity, what types of applications are you guys interested in writing (you don't have to give away ideas, just in general)?
Anything that would prove useful for my programming experience. I recently made a Launcher for FS2_Open, which ended up being noticed by the developers of the port. But I have made many things, that although they may never see the light of day, they were absolutely necessary to make, since I have learnt a lot of things by making them.

Example: I have made a framework, which grew big over the time, and became a library which is used by my colleagues and friends of mine (and me, of course) to make programs easier to make. This library includes basic parsers, string actions, templates for maps for game creation, and much more. I am now trying to make a very basic chat application. The internet is filled with applications of this kind, but the knowledge I will gain in the process will be invaluable.

I recommend you do something similar. In order to become a good programmer, you need knowledge that will be gained by making useless programs. In order to become great programmer... well, you need to become a good programmer first.
Soulstorm is offline   0 Reply With Quote
Old Aug 5, 2007, 04:08 AM   #8
janey
macrumors 603
 
janey's Avatar
 
Join Date: Dec 2002
Location: sunny los angeles
Quote:
Originally Posted by DHagan4755 View Post
Just out of curiosity, what types of applications are you guys interested in writing (you don't have to give away ideas, just in general)?
Like the people above me, stuff I need/want. Usually as a replacement for some awful software or something where there exists no application to do it.

Right now I'm working on a menubar item that keeps track of a certain something for me...the original app is awful and unusable for long periods of time (which is what it's supposed to do...), and I don't use Dashboard, which would have been the easier way out. I'm having an insane amount of trouble though, because there are a TON of ways to manage the item in question and I can't account for all of them, nor can I think of a good way to do so
__________________
iPad | 15" MacBook Pro | black (iPhone 3GS|MacBook) | Mac mini server
moof!

janey is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
The App Store app thinks Xcode is installed, but I deleted Xcode. moonman239 Mac Applications and Mac App Store 3 May 6, 2014 05:53 PM
xcode newbie Kapthehat iPhone/iPad Programming 6 Jul 2, 2013 12:25 AM
Moving from xcode 3.2 to xcode 4.5.2 compilation error for 'abs' macro in stdlib.h hrishidev Mac Programming 7 Jun 2, 2013 10:36 AM
Xcode 3 vs Xcode 4 when dealing with Objective-C timebourne Mac Programming 8 Sep 23, 2012 05:36 PM
XCode 4.4.1 to Xcode 4.5 in Mountain Lion VinegarTasters OS X 10.8 Mountain Lion 2 Sep 19, 2012 08:55 PM

Forum Jump

All times are GMT -5. The time now is 04:54 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC