c++ application

Discussion in 'General Mac Discussion' started by synthetickittie, Nov 2, 2003.

  1. macrumors regular

    Dec 17, 2002
    Ive been coding a lot different languages for a few years now but only web based(php, actionscript, html...). Now Im a freshmen in college and in a c++ class. I now have an itch to go over what the class has been teaching, which I already have in a few thing but now Im very anxious to make my first (very simple but still want learn how to at least do the VERY basics of it first) graphical application. As for my class the professor has told me that this and the next class just explore everything in c++ that you can do with making programs for the terminal. Ive been using xcode but when I look in the applications part for both cocoa and carbon Im only seeing c not c++.. why is this? where can I learn the difference in cacoa and carbon? And lastly how can I use what I know in c++ to build a visual app?

    btw- my major isnt writing (im around the bottom of my class in that subject) lol so don't kill me if I messed somethin up.. I only got numbers/code type of brain over here
  2. macrumors G3


    Aug 30, 2003
    Especially for Cocoa, the usual thing is to use Objective-C -- you can mix and match it with C and C++ files (and can even mix Objective-C into your C++ files if you really want to mix metaphors).

    Don't worry about the differences between the different C flavors too much just yet. Objective-C really is plain old C with a handful of OO things added, and C++ only has minor differences from plain C (with lots and lots of stuff added). You can use regular C functions and libraries from within a C++ program, and vice versa.

    There _is_ an option to create C++ tools and C++ classes, though. Where are you looking?

    Finally, on terminal programs, you might be best off compiling those from the terminal (you can still use Xcode's editor if you like). The IDE can be a very nice thing indeed when your projects start including graphical thingies and multiple libraries and frameworks, but it tends to just get in the way when you're working on the toy programs that tend to be used in classroom examples.

    [edit out random nonsense words I don't even remember typing]
  3. Moderator emeritus

    Jun 25, 2002
    Gone but not forgotten.
    Carbon is not an object-oriented application framework; therefore, you can use it in C++ but Apple doesn't specify it in those template projects. (There are others, such as Qt and PowerPlant that utilise C++.)

    Cocoa is an object-oriented application framework and is highly dynamic, thus it requires a dynamic object-oriented language such as Objective-C or Java.

    To learn the differences of the application frameworks, you might try Apple's own documentation or the Mac DevCenter on O'Reilly's website.

Share This Page