Quick and Dirty C++ on Your Mac
The first thing you need is the development kit, Xcode. Download it for free here. It’s 932MB so it might take a while.
Xcode can be used to make simple console applications, like we’re going to do, but can also make 64-bit applications that can tax the best systems Apple makes. We’re not going to touch 1/10,000 of the thing’s power.
It will compile C, C++, Objective C, Java, Cocoa, Carbon, and even Applescript. It will import your old CodeWarrior projects. You can make applications, libraries, device drivers or anything else your little heart desires.
We’re going to build a HelloWorld console app.
Download Xcode, use the default install, and you can find the Xcode application itself here:
Notice that it’s not in your Applications folder or your Utilities folder. The installation created a Developer folder and buried the Xcode app inside of that. Grab the Xcode icon and drag it to your Dock. Launch it.
File menu, New Project, Command Line Utility, C++ Tool.
Give the project the name HelloWorld, don’t change the Project Directory, click Finish. Two windows will open, we care about the main.cpp window:
Click the Build and Go icon. It should compile, execute, and display the Run Log that contains our command line output.
This little app contains the important line
std::cout << "Hello, World!\n";
This tells you the proper format for generating output to the console. The \n is the carriage-return/new-line syntax. Now we can build a simple Focus-counting app.
This calculates how much Focus your pet has after four Claw hits. Nothing spectacular and we probably made a mistake somewhere, but it compiles and runs smoothly.
By modifying this program, we could extrapolate the effects of Go For The Throat dumping 50 Focus on our pet when we crit 25.43% at a shot rate of 1.96 seconds per shot. We could increase our Focus regeneration as if we had points in Bestial Discipline. We could test different combinations of each talent spec, send the output to a text file, import that data into Excel, and build graphs showing the Focus vs Time for each spec.
But not today. Soon, perhaps, we’ll see.
Comments
22 Responses to “Quick and Dirty C++ on Your Mac”
Leave a Reply




BRK CAN CODE?!!
BRK are you sure I don’t go to sleep and become BRK you really are starting to seem like my alter ego!
If you want some help let me know that program cant be too hard to make. I’ll fire up the mac because my windows box has no dev kit on it.
I was going to ask what that had to do with WoW, but then I started to see what it was used for!
Answering your non-question, yep, mistake found: instant Pet abilities are not subject to the global cooldown… At least they didn’t seem to in the short test I made when creating that small focus monitoring add-on…
BRK has two BS degrees, one of which is in computer science. We know enough about coding to know we don’t know how to code. Calling us a programmer is an insult to programmers.
But we know the rudiments and we know how to learn.
like a lot of us ….. know just enough to be dangerous ….. lol
gah! a lesson in programming and for the mac nonetheless! I knew there was a reason I liked BRK… as I write this on my iPhone!
@ pelides
u mean the iPhone where ur locked into using AT&T ….. nice toy but crap contract … they got u dude … lol
@secondworst
the contact is actually better than what I had after 7 years with Sprint. I knew exactly what I was doing going into the purchase. is it so wrong for me to want a cool toy?
BRK might still be a danger to society even if he didn’t know how rudimentary coding. I can’t imagine myself going so far as coding my own addon for WoW. I like that game and all but I don’t think I have that sort of determination. Good luck on getting it to work.
-Narian
If you look, that’s not actually an addon. Its just a simple (at least to people who know enough code to be dangerous) text program that’s doing calculations to allow BRK to estimate focus levels. Seeing as how he’s spending gold (not really money, but just as hard to come by) to respec and test things, why not take 15 minuets to write something like that to do tests for you. That’s less time than it would take to setup a new talent build, find a group, test the build for an hour and pour over the data gathered by your favorite data gathering addon. Anyway, nice work BRK, and I love the site.
Stonespire and Fluffy, Hellscream
Ah man now my head hurts.
i’ve actually been thinking about getting into C++ or java a little bit recently and this reminded me. although this would probably be for non-WoW-related purposes, do you have any advice for where a coding beginner should go to get started? (or a suggestion of a different coding language to learn first?)
@zeej: if you never programmed before, stay away from C++ and related languages: case sensitiveness and overall “unfriendliness” will make your head spin!
You can try Basic or Pascal, both are easily available (check MS site for Visual Basic, Codegear for Turbo Pascal). I’d recommend Pascal as it can be described as having the power of C++ without it’s headaches! Both have free versions available that you can download, try and use to make your projects.
@someone: thanks much for the feedback. I’d been warned about C++, but I guess was just a little apprehensive about putting a lot of effort into learning a language that I knew was mostly just for practice and that I would end up dropping for something more useful later. Sounds like Pascal might be more useful than that though, so I’ll look into it. Thanks again.
You may also look into Python, very nice and simple, has a very detailed beginners guide online as well
Any chance of ya posting the code plain-text, BRK? Much as I dislike C/C++, it’s the syntax errors I (always end up typing in) loath more.
Hallistra and Greywind (Nazgrel)
@pelides
not at all …the toy is awesome …i hate those forced contracts that come with them …
i pay per second billing on outgoing calls only …same evening and weekends that pretty much everyone gets but for an average 1500 min/mo usage for 2 phones …i pay average $90/mo …. there is no way your going to beat that ….
@secondworst
Well, you made your consumer choice. I made mine. If we’re both happy, awesome!
I have an iPhone which makes me very happy. The contractual obligation and service offering doesn’t work for you. You didn’t get an iPhone. Awesome! You have a service that works for you.
Having choice in the marketplace is good. If you’re happy with yours and I’m happy with mine… we both win!
I’m not in a competition with anyone to see “who has the cheaper service plan”.
Not to be picky, but I’d be hesitant to call any of that code C++, since it doesn’t really use any of the extended capabilities that C++ offers over C.
Ah well.
Thats like saying
MsgBox(”Hi”)
Is VB6 and Not VB.net.
Its dependent on the compliler is it not?
test
How do you get a comp sci degree and not know how to code?
I find that extremely alarming…
Any CompSci program worth its salt should, at the least, graduate a competent programmer.
That app you have in your example should take 15 minutes tops…
The EJ folks have theorycrafted this out.
http://elitistjerks.com/f31/t11420-hunter_bm_raiding_hu…orycrafting/p15/#351
Summary:
-At 23.1% crit you can drop to 1/2 BD (with 2/2 GftT).
-At 29.5% crit you can drop to 0/2 BD (with 2/2 GftT).
This is assuming you’re using a Cat/Ravager with Bite+Claw/Gore.
Poor BRK keeps asking questions that EJ has already answered.
http://episteme.arstechnica.com/eve/forums/a/tpc/f/39309975/m/680000745831?r=461006487831#461006487831
BRK, I hope that helps.