C++ programming

Discussion in 'Mac Programming' started by jmfel1926, Sep 13, 2012.

  1. jmfel1926 macrumors member

    Joined:
    Jun 22, 2012
    #1
    Hello , i am a student and i have C++ lesson for the next two semesters. Do you know any programm of OS X to create C++ projects? I know about codeblocks .. any other options?
     
  2. tiwizard macrumors regular

    Joined:
    Jul 12, 2010
    #2
    Depending on if you want to use the Qt Framework, there is also Qt:

    http://qt.nokia.com/products/

    Another alternative would be to use Apple's XCode, which you can use for ObjC, C, and C++ among other languages. This would probably be my recommended approach. XCode is pretty good.

    Of course, if you're just looking for a text editor and want to compile on the command line, I'd recommend Sublime Text 2. There's also TextMate 2 (which is now free and open source), and it's pretty regularly updated now and is gaining some cool new features that ST2 used to have over it.
     
  3. jmfel1926 thread starter macrumors member

    Joined:
    Jun 22, 2012
    #3
    thx for the answer ... it is really helpful ... i also have to mention something... i want to compile and run my projects on both OS X and W7 and not having to change it every time i switch OS... so what is your suggestion now? thx !
     
  4. tiwizard macrumors regular

    Joined:
    Jul 12, 2010
    #4
    If it's basic stuff (ie. no UI, command line only), you should be able to compile it on whatever OS with GCC.

    However, you'll need some sort of text editor or IDE on the computer you are developing on. For example, Visual Studio on Windows (not sure how to set that up with GCC/MinGW), XCode on Mac, etc.

    I'm not 100% sure, but you might be able to compile C++ with VC++ on Windows/Visual Studio and use the same code with LLVM or GCC on Mac (with XCode or whatever). You'll have to check on that.

    It's also worth mentioning that Qt already is cross platform and I'm 100% sure you can use the same code on Windows and Mac. That may be the easiest approach to get started quickly, but it does require the Qt framework if it's a project with a UI.
     
  5. iHutch105 macrumors member

    Joined:
    Aug 8, 2011
    #5
    I should imagine that for your first semester at least you'll be writing console applications.

    For this purpose, Xcode works fine. Just create a new Command Line Tool and set the type to C++. You should have no problem copying the source file (.cpp or whatever) over to Windows and compiling in a Windows environment.

    For Visual Studio, you'd just create a new project, click 'Add Existing Item' and then add your source code.

    Alternatively, if you don't want to use an IDE, you could simply install a compiler (on Windows or Mac) and write the source code in a text editor (there are editors that include syntax highlighting for various languages, such as vim or TextWrangler). The compilation would be, more or less, the same in both environments.

    Hope this helps.
     

Share This Page