8 Replies Latest reply: Oct 28, 2008 7:58 AM by rt200
rt200 Level 1 Level 1 (0 points)
Hello!
I'm trying to learning C++, and use Xcode for this.
How can I get graphics into C++ with Xcode?
Are there graphic libraries in Xcode that can be used in C++?
Maybe there are none because Xcode console cannot show graphics.
Thank you very much.

iMac Intel Core Duo, Mac OS X (10.5.4)
  • etresoft Level 7 Level 7 (26,600 points)
    You are talking about some disparate technologies there. You can't really compare then in the same sentence. Also, your question is very restrictive in that you are asking about C++ libraries for the Mac that you can use with Xcode. Such things do exists, but if you are still learning Xcode, they may be too difficult right now.

    I would recommend narrowing down exactly what you want to do on the Mac - graphics-wise. It may be something that you could easily do in Cocoa or Carbon without getting overwhelmed.

    A good place to start would be to look at the Developer examples and find one that does something similar to what you want. Study that example and adapt it. It may not actually use C++, but then, that is a different issue. Learning C++ and learning graphics do not really go together. You can do one - and the other - and eventually combine them - but not at first.
  • rt200 Level 1 Level 1 (0 points)
    Thanks for your reply.
    My purpose was to learn some popular programming language which hopefully can also handle graphics (for example to build a user interface for my programs ).
    Write or wrong, but I chose C++ , and so far wrote a couple of little programs in it, using Xcode, a very handy tool.

    The programs work fine, but lack a nice-looking user interface, i.e. something with buttons, fields for a user to fill, colored background, etc .

    I can see now that my knowledge is too limited for me to be able to use other Xcode tools to add such graphics to my programs.

    What languages people normally use to write their programs c/w with colored user interfaces?
  • etresoft Level 7 Level 7 (26,600 points)
    You can use Objective-C (AKA Cocoa) in your current Xcode projects. You can also use the old Carbon libraries. Neither is C++ though.
  • rt200 Level 1 Level 1 (0 points)
    Thank you.
    Looks like no matter how breathtakingly interesting, C++ has a limited usage, doesn't it?
  • etresoft Level 7 Level 7 (26,600 points)
    I wouldn't say that. I used it for 14 years almost exclusively. I think it is more accurate to say that vendors provide their own methods for doing graphics. Usually it is best to do as the vendor wishes. Microsoft used to support C++ with MFC, but not so much anymore. Apple used to support C++ with MacApp, but no one ever used it. There are some 3rd party libraries (Qt, Wx, etc) that are either built on C++ or have C++ interfaces. Usually they are Linux libraries that have been ported to run on Macs and/or Windows. However, if you choose to use those, you do so because you just want to or you need cross-platform compatibility. By doing so, you are leaving the mainstream (of the niche that is MacOS X).

    Graphics are tied very closely to the OS and a vendor's implementation. You go against the stream at your own risk. Lots of higher level code is done with C++. C++ can interface with just about any graphics library with no problem.
  • ericmeyers Level 4 Level 4 (1,410 points)
    Well you can have it both ways. You can mix Objective-C and C++. Do your GUI stuff using Objective-C and your other stuff in C++. It's no problem.

    http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Articles/ch apter12_section_1.html#//appleref/doc/uid/TP30001163-CH10-SW1

    Eric
  • rt200 Level 1 Level 1 (0 points)
    Thank you very much for the info
  • rt200 Level 1 Level 1 (0 points)
    Got it.Thanks for the link!