C++ graphic programming

Discussion in 'Mac Programming' started by quanganhct, Jan 16, 2011.

  1. quanganhct macrumors member

    Joined:
    Dec 29, 2010
    #1
    Hi,
    I 'm now learning C++ accordingly to my school's program, and i plan to take a course ahead myself (in graphic , of course). So here's the problem, i cannot use the header file "graphics.h", i search thoroughly on Google, and it seem that Mac doesn't support that library. It trouble me alot, so i'm here to ask for help.
    Anyone have any ideas ? (I use Mac Leopard, Xcode version 3.2.5)
    Thanks in advance.
     
  2. mydogisbox macrumors member

    Joined:
    Jan 16, 2011
  3. quanganhct thread starter macrumors member

    Joined:
    Dec 29, 2010
    #3
  4. subsonix macrumors 68040

    Joined:
    Feb 2, 2008
    #4
    What's graphics.h? Is it a Windows header? Standard C++ doesn't have any graphics library. I also would suggest OpenGL, probably not the most beginner friendly but..
     
  5. lee1210 macrumors 68040

    lee1210

    Joined:
    Jan 10, 2005
    Location:
    Dallas, TX
    #5
    The problem here is not that you are missing the header. You could copy that from a machine at school. The problem is the library itself that contains the definitions for the functions, Objects, etc. the header gives you definitions for. If this isn't a cross-platform library, this just isn't going to work.

    If you're tied to a school that does Windows-specific instruction, you're going to need to do the work on Windows. I wouldn't try to hack together projects on OS X using other libraries and hope they'll work when you try to turn it in for the class.

    -Lee
     
  6. ender land macrumors 6502a

    Joined:
    Oct 26, 2010
    #6

    OpenGL works in C++ on Mac just fine (I programmed for a graphics class extensively on my mac last semester).
     
  7. chrono1081, Jan 16, 2011
    Last edited: Jan 16, 2011

    chrono1081 macrumors 604

    chrono1081

    Joined:
    Jan 26, 2008
    Location:
    Isla Nublar
    #7
    +1

    I hack together programs on Mac that should be on Windows and unless you know what your doing it can be a nightmare to get working. I often have to re-write a lot of code simply because I don't want to work in Windows (can you blame me for not wanting to use MFC???). Also if your professor / teacher wants to run your code you may be in trouble. Luckily for me I usually only have to provide a screenshot of the output.

    Also as others have stated graphics.h appears to be a custom header file so you should be able to just copy it and the corresponding source file (if it has one) from your machine but chances are it contains either MFC or DirectX code. Not to mention with graphics libraries (or any external library) you have to set your IDE up to recognize it.

    Honestly if you are getting started with graphics I would suggest learning SDL over OpenGL since OpenGL may confuse the crap out of you at first. There is an excellent site for setting up and learning SDL however the Mac instructions are a little outdated for setting it up.

    http://www.lazyfoo.net

    One last thing OpenGL is programmed using C++.
     
  8. mydogisbox macrumors member

    Joined:
    Jan 16, 2011
    #8
    opengl spec

    Not quite true. OpenGL is a spec and can be programmed in C++ given an OpenGL library written for C++.
     
  9. chrono1081 macrumors 604

    chrono1081

    Joined:
    Jan 26, 2008
    Location:
    Isla Nublar
    #9
    Haha I knew someone would catch that :p I was too lazy to edit it.
     
  10. quanganhct thread starter macrumors member

    Joined:
    Dec 29, 2010
    #10
    okay thanks alot. So it means that i should use other library like OpenGL or SDL. Well if this is not a school program, i 'll try these out, but you know, when i mean a school program, there're test and exam also , so if i cannot practice the function they use in class , i 'll be on an edge of failing. I'll try paralel desktop then .
    Anyway, thanks alot for your aiding.
    Cheers.
     
  11. nguyenvantrongvn macrumors newbie

    Joined:
    Mar 26, 2017
    #11
    I learning c++ graphics and i made this program last week. This program teaches how to move the circle in C++.
     

Share This Page