Best Free C++ Compiler?

Discussion in 'Mac Programming' started by bursty, Feb 13, 2006.

  1. macrumors 6502a

    bursty

    Joined:
    Jan 31, 2004
    Location:
    STL
    #1
    I am forced to take a basic C++ class for my Engineering degree, but I cant stand the ancient Windows machines they have in the computer lab. What are some free compiler options for my PB? I would prefer freeware just because after this semester, I doubt I would ever use C++ again. Any suggestions? :)
     
  2. Moderator emeritus

    Joined:
    Jun 25, 2002
    Location:
    Gone but not forgotten.
    #2
    The Apple developer tools, Xcode, are free.

    They should be in the Install folder within your Applications folder.
     
  3. macrumors 68030

    slooksterPSV

    Joined:
    Apr 17, 2004
    Location:
    Nowheresville
    #3
    Personally I think GCC is the only C++ compiler out there. Funny I know, seriously, I second XCode, its awesome, just learn the environment. I do a lot with it in my spare time.
     
  4. thread starter macrumors 6502a

    bursty

    Joined:
    Jan 31, 2004
    Location:
    STL
    #4
    And these will compile programs that will transfer over to my professors Windows machine and compile in Visual Studio no problem? If so, thats amazing. They wanted me to drop ~$200 on Visual Studio. :rolleyes:
     
  5. macrumors 6502

    Joined:
    Nov 30, 2005
    #5
    GCC & the XCode toolset fully support the standard C and C++ languages. MSVC still didn't have complete C++ compliance last time I used it, but that was some time ago. In any case, the deviations are small and adapting "proper" C++ code takes a very small amount of time.

    There are also versions of GCC for Windows such as MingW32. There aren't any IDEs as nice as XCode, but there are several that are usable. I'm no expert so I don't want to suggest anything.

    What you obviously won't be able to do is develop programs that are intended to use Microsoft's specific Windows libraries, which roughly means anything that performs operations you wouldn't expect a text based operating system to perform. There are third party libraries that let you do things like create and manipulate windows in sufficiently generic ways to build on both Mac and Windows, but I suspect they'll be outside of the realm of your course.

    So, it really depends what your course is about. If it is more about the normal language without any Microsoft extensions - e.g. data processing, manipulation, advanced calculations, etc - then you won't have any problem. If it starts to head into "we're going to design our window here, then make it work by writing this code..." or "we'll display the output in a simple message box" then you probably won't be able to use a Mac for development - but it is still worth looking into the Windows versions of GCC.
     
  6. Moderator

    balamw

    Staff Member

    Joined:
    Aug 16, 2005
    Location:
    New England
    #6
    :eek: :confused: :eek:

    If you want full compatibility with VS and don't want to pay for it, just stick with the FREE Microsoft VC++ toolkit, which is the same compiler they use in VS, without the VS IDE and GUI frameworks. http://msdn.microsoft.com/visualc/vctoolkit2003/ Of course that won't run on your PB without VPC. ;)

    I too only think of gcc as the one true C/C++ compiler. Thank god it's built in in Xcode.

    B
     
  7. Moderator emeritus

    Joined:
    Jun 25, 2002
    Location:
    Gone but not forgotten.
    #7
    It depends on what they're trying to do with it.

    If you write standard programmes (without any GUI, DOS, or Mac/Windows-dependence), even Visual Studio shouldn't have a problem with all optimisations turned off there.
     
  8. thread starter macrumors 6502a

    bursty

    Joined:
    Jan 31, 2004
    Location:
    STL
    #8
    The programs are very simple, such as the one I am working on now:

    Write a program that writes to a file, projectile.txt, a table that shows the height of a projectile launched straight up, for each second from launch time (time zero) until the projectile hits the ground. The last entry in the table should show a projectile height of 0. The height after t seconds is given by:

    S = Vot -1/2gt^2

    Very basic, easily coded in a few minutes but it does use Command Prompt in Windows, which is why I wasnt sure if OSX has a similar Command Prompt (maybe Terminal or something? :confused: ) I guess I will just open up Xcode and see what happens.
     
  9. Moderator

    balamw

    Staff Member

    Joined:
    Aug 16, 2005
    Location:
    New England
    #9
    Yes. Terminal = Command Prompt.

    You don't need Xcode for this, just use vi and gcc from within Terminal and become one with your unix side. ;)

    B
     
  10. macrumors 6502

    Joined:
    Oct 12, 2005
    #10
  11. thread starter macrumors 6502a

    bursty

    Joined:
    Jan 31, 2004
    Location:
    STL
    #11
    Got everything working and got my program to compile and run unaltered, which I had running on Windows earlier, which is great news! Thanks for the help! :)
     
  12. macrumors 6502a

    jalagl

    Joined:
    Jun 5, 2003
    Location:
    Costa Rica
    #12
    If you're developing for Windows, you can also download Microsoft's Platform SDK. It has all the compilers, linkers, etc that you need to create Windows programs.

    It doesn't include an IDE, though...
     
  13. macrumors 6502

    Joined:
    Apr 16, 2003
    Location:
    Boston, MA
    #13
    I think the platform SDK still requires a compiler. If you're using visual studio in class, and you've got a windows computer, I'd download Visual C++ express, which is free for a year.
     
  14. Moderator emeritus

    Joined:
    Jun 25, 2002
    Location:
    Gone but not forgotten.
    #14
    If you have something that doesn't compile, saying that something can't be found, it's usually that people have tried to use DOS C bindings with header files like conio.h and dos.h. As long as you stay away from that sort of thing, you should be fine.
     
  15. Moderator

    balamw

    Staff Member

    Joined:
    Aug 16, 2005
    Location:
    New England
    #15
    Thanks for reminding me about that! Note that it's not free for 12 months of usage, but it is free if you download it before November 7, 2006.

    http://msdn.microsoft.com/vstudio/express/support/faq/#pricing
    B
     
  16. macrumors 6502

    Joined:
    Apr 16, 2003
    Location:
    Boston, MA
    #16
    Good to know, that's a change from what they originally had planned. A good idea by MS, if you ask me. That's the nice thing about the Mac platform - the developer tools are free. These aren't the full thing, but good for hobbyists/beginners
     
  17. macrumors G5

    gnasher729

    Joined:
    Nov 25, 2005
    #17
    As others said, XCode is free. www.metrowerks.com used to have a free download of the CodeWarrior compiler (limited to 32 files, no optimisation), but that seems to be gone.
     
  18. macrumors member

    Joined:
    Apr 21, 2008
    Location:
    Houston
    #18
    in my opinion Xcode is really hard to use, unless you really know what your doing, and most of the features it has your never going to use, or even understand what there for. An easier IDE to learn and use is Netbeans. Thats what I use, its free to download. Another mac IDE is eclipse.
     
  19. macrumors member

    Joined:
    Sep 17, 2008
    #19
    In my opinion any piece of software is hard to use if you don't know what you are doing, and netbeans and eclipse have much more features than XCode.
     
  20. macrumors member

    Joined:
    Jun 9, 2008
    #20
    xcode compiler

    I posted in the iphone programming section thinking that it was the right place. However, this thread seems more applicable.

    Since the wiki said to learn C first, I bought the C programmign guide and wanted to do the exercises in xcode while writing C.

    Is there a guide out there describing how to compile programs in xcode written in C?

    thanks..
     
  21. macrumors 68040

    lee1210

    Joined:
    Jan 10, 2005
    Location:
    Dallas, TX
    #21
    This thread is 32 months old. Start a new one if there's a new question.

    -Lee
     
  22. macrumors regular

    appledyl

    Joined:
    Apr 20, 2009
    Location:
    USA
    #22
    Xcode!!!

    Xcode all the way! It's on your mac disk or on hard disk. If you don't have it then download it online for free. You just need to make a special Apple Developer Community ID. WONDERFUL PROGRAM!!!!
     
  23. macrumors newbie

    Joined:
    Jun 13, 2011
    #23
    um these are not free you have to sign up and pay to use them... can some one explain what im doing wrong????
     
  24. macrumors 68040

    Joined:
    Feb 2, 2008
    #24
    Yes I can, you are responding to a 5 year old thread. The latest version of Xcode is $4.99 on the Appstore, I don't think you have to sign up to get it from there. But, you have Xcode on your OS X install disk.
     
  25. Moderator

    balamw

    Staff Member

    Joined:
    Aug 16, 2005
    Location:
    New England
    #25
    ROFL ;) Any thread where PPC was still the norm should probably not get added to.

    Correct:

    Xcode 4 is $4.99 from the Mac App Store.

    Xcode 3 is usually available on your OS X install disc, and is also available from Apple Developer Connection as a free download.

    Down in the bottom right of the page here: http://developer.apple.com/xcode/ you will find a link that says "Looking for Xcode 3". Click that and register for a free ADC account using the "join now" link on that page.

    B
     

Share This Page