Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Editing/compiling on a Mac
Index -> Programming, C++ -> C++ Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
slAag




PostPosted: Mon Oct 29, 2007 3:23 pm   Post subject: Editing/compiling on a Mac

Does anyone know what I should use and how I should compile on a Mac? Everything I've seen so far is for windows. Try and keep the downloads small too, cause im on dial-up...
Sponsor
Sponsor
Sponsor
sponsor
rdrake




PostPosted: Mon Oct 29, 2007 3:38 pm   Post subject: RE:Editing/compiling on a Mac

I thought Xcode supported C++, and that g++ was installed by default? It should be on your install disc. You can use any old editor for writing code if you wish, and something like the following to compile:

code:
g++ <file>.cpp -o <file>
slAag




PostPosted: Mon Oct 29, 2007 3:50 pm   Post subject: Re: Editing/compiling on a Mac

Could you explain a little better? Im not really familiar with this stuff yet, but i did find a file called "Xcode Tools". Am i on the right track with that?
Clayton




PostPosted: Mon Oct 29, 2007 3:57 pm   Post subject: RE:Editing/compiling on a Mac

Sounds right. And the above line that rdrake put in code tags is what you type in the terminal to compile your code, replacing <file> with the actual filename of course.
slAag




PostPosted: Mon Oct 29, 2007 4:15 pm   Post subject: Re: Editing/compiling on a Mac

Well, ill go mess around with it for a bit then and try to figure out what im doing.
slAag




PostPosted: Mon Oct 29, 2007 5:39 pm   Post subject: Re: Editing/compiling on a Mac

Well, the Xcode editor wont let me compile the file for some reason. Could you tell me how to get into the command line?
Tony




PostPosted: Mon Oct 29, 2007 6:04 pm   Post subject: RE:Editing/compiling on a Mac

Xcode does indeed come with the GCC suite, so g++ should be on your system. Though an enterprise level IDE such as Xcode is not needed (and indeed could be a bit overwhelming) for a beginner.

Your terminal is located in.. well: Appications -> Utilities -> Terminal

I would strongly encourage to keep it in your dock though.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
slAag




PostPosted: Mon Oct 29, 2007 6:57 pm   Post subject: Re: Editing/compiling on a Mac

Thanks, I keep everything in my dock Smile Yeah, Xcode is a little overwhelming, but i think ive got the gist of it.
Sponsor
Sponsor
Sponsor
sponsor
slAag




PostPosted: Mon Oct 29, 2007 7:21 pm   Post subject: Re: Editing/compiling on a Mac

K, i have it mostly figured now, and its working. Thanks for all your help guys.
wtd




PostPosted: Tue Oct 30, 2007 12:13 am   Post subject: RE:Editing/compiling on a Mac

Oh, and makefiles are your friend!
slAag




PostPosted: Tue Oct 30, 2007 3:06 pm   Post subject: Re: Editing/compiling on a Mac

makefiles?
wtd




PostPosted: Tue Oct 30, 2007 3:27 pm   Post subject: RE:Editing/compiling on a Mac

http://en.wikipedia.org/wiki/Makefile
slAag




PostPosted: Tue Oct 30, 2007 3:45 pm   Post subject: Re: Editing/compiling on a Mac

Is there a way to clean up the output screen a bit? When i run the "hello world!" program, i get this in the output window.

Last login: Tue Oct 30 16:28:24 on ttyp2
/Users/<user>/Desktop/C++/helloworld; exit
Welcome to Darwin!
[<name of computer>:~] <user>% /Users/<user>/Desktop/C++/helloworld; exit
Hello world!logout
[Process completed]
Tony




PostPosted: Tue Oct 30, 2007 4:03 pm   Post subject: RE:Editing/compiling on a Mac

There is nothing extra in that output, everything appears as expected. Though if you don't call the exit (why are you doing that?), you don't have to see the welcome/exit statements more than once.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
slAag




PostPosted: Tue Oct 30, 2007 4:18 pm   Post subject: Re: Editing/compiling on a Mac

I dont think i did anything extra... But i only started C++ yesterday, so i wouldnt be surprised if i did.
Display posts from previous:   
   Index -> Programming, C++ -> C++ Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 15 Posts ]
Jump to:   


Style:  
Search: