Learning C++-Best Program to Use on A Mac?

Discussion in 'Mac Programming' started by Cerizzle, May 2, 2009.

  1. Cerizzle macrumors member

    Joined:
    May 2, 2009
    Location:
    Atlanta, GA
    #1
    Im learning C++. I wanted to know if you guys now anything like Visual Basic that i can use on a Mac. If i can save work in it and open it in Visual Basic, that would be very greatfull. I found NetBeans but it said something about a compiler is not installed, IDK how to get one.

    Any ideas?
     
  2. LtRammstein macrumors 6502a

    LtRammstein

    Joined:
    Jun 20, 2006
    Location:
    Denver, CO
  3. VPrime macrumors 68000

    VPrime

    Joined:
    Dec 19, 2008
    Location:
    London Ontario
    #3
    I'm confused... Why are you bringing up Visual Basic if you want to program in c++?

    Visual Basic is a programming language as is C++...

    If you mean an IDE, some thing like Visual Studios then the XCode environment would be the closest thing... It is free and included with OSX (it is on the install disk). If you lost your install disk go to apples site and look for the developer section the tools are available for download there as well.

    Though in my opinion, doing c++ on windows in Visual studios is much nicer then Xcode (just what I am used to though).
     
  4. kastenbrust macrumors 68030

    kastenbrust

    Joined:
    Dec 26, 2008
    Location:
    North Korea
    #4
    I too prefer coding C++ in visual studio, Xcode sucks but hey it runs on a Mac and its free, whereas Visual Studio isn't. If you want something that will make programs for both Windows and Mac and you want to use C++ then use RealBasic.
     
  5. ChrisA macrumors G4

    Joined:
    Jan 5, 2006
    Location:
    Redondo Beach, California
    #5
    The compiler comes as part of Apple's "xcode". Xcode is on your Mac OS X install DVD but not installed by default ot you can download xcode for free from apple.com. If your DVD is more than a few months old, get the newer xcode version directly from apple.com

    You can also get a compiler (GNU's gcc is the one that comes with xcode from the gnu.org website. (that's where Apple gets it from)

    Most C programmers simply use a text editor and a few terminal sessions. But if you like an intagrates development environment (IDE) you can use either Sun's "netbeans" or Apple's "xcode" ot IBM's "Eclipse. All of these depend on GNU's gcc compiler.

    I've been at this, full time from back when "c" was new, long before there was a C++. My advice is to start simple with the least amount of tools. Write a "Hello World" program first and get it to work.

    If you are just learning C++ and writing simple programs, likey where all the source code is in only a very few files then you can just run out of a terminal. Using an IDE just adds another layer of complexity and one more thing to learn. However on a complex program it can help. But learn just with a text editor and terminal at first.
     
  6. Cerizzle thread starter macrumors member

    Joined:
    May 2, 2009
    Location:
    Atlanta, GA
    #6
    Sorry, i ment Visual Studios. I have to learn C++ for my major. I was wondering if there anyone knows and tutorials for XCode.
     
  7. LtRammstein macrumors 6502a

    LtRammstein

    Joined:
    Jun 20, 2006
    Location:
    Denver, CO
    #7
    I recommend using a Terminal text editor, like VIM or emacs.
     
  8. Cerizzle thread starter macrumors member

    Joined:
    May 2, 2009
    Location:
    Atlanta, GA
    #8
    Whats the difference between the two? XCode and a Terminal text editor?
     
  9. VPrime macrumors 68000

    VPrime

    Joined:
    Dec 19, 2008
    Location:
    London Ontario
    #9
    Oh my, I was not aware realbasic does c++.. Is this new? the last time I looked at realbasic it was a Basic like language+IDE only..
     
  10. lee1210 macrumors 68040

    lee1210

    Joined:
    Jan 10, 2005
    Location:
    Dallas, TX
    #10
    XCode is an IDE. It has a nice text editor (with autocomplete, syntax highlighting, usw.), integrates the compiler, integrates the debugger, a project manager, etc. This definitely has its advantages, especially with an Object-Oriented language like C++.

    Vim (we'll exclude that heretical emacs junk =) ) is a(the?) terminal based programmer's text editor. You have to learn key combinations that will seem difficult at first, but you can print a cheat sheet and get going pretty quickly. It, or its ancestor vi, are available on every UNIX and UNIX-alike system I've ever encountered. This means that when you're working on a group project in the lab with your classmates on a bunch of linux or solaris machines, you can sit down at any of them you're ready to go. You won't have to say "I don't know how to do this, i only know [Eclipse|XCode|Visual Studio]. You don't even have to run a window manager to take a quick look at or make a quick edit to a text file. If you go this route you'll have (get?) to learn to compile and debug from the terminal as well, and you may even learn some other tools like grep, awk, make etc. to accomplish tasks. Once you have these skills, you'll be able to take them to any UNIX or UNIX-like system (linux, OS X, solaris, BSD, etc.) and be ready to write, compile, run, and debug code. You won't need the IDE you're used to using available before you can start working.

    I think i've made my bias(es) extremely clear in answering an otherwise benign question. =)

    -Lee
     
  11. rich.smith macrumors member

    Joined:
    Aug 21, 2008
    #11
    I too would recommend using an editor and the C++ compiler (gcc) that comes with OS X. IMO, the IDEs become more important when you start GUI programming.

    There are plenty of free editors for the Mac (Smultron and TextWrangler are two that I use).

    You will have plenty to learn with the language (C++) and the basic tool chain (gcc, make, gdb) without learning an IDE.

    I suggest downloading the "Thinking in C++" books by Bruce Eckel. They are free and available here: http://mindview.net/Books/TICPP/ThinkingInCPP2e.html
     
  12. rrpalma macrumors member

    Joined:
    Sep 21, 2008
    #12
    Now Lee, who are you calling heretical? Those conformist vi users ...
    :p

    emacs rules !!:)
     
  13. chrono1081 macrumors 604

    chrono1081

    Joined:
    Jan 26, 2008
    Location:
    Isla Nublar
    #13
    Lol the above debate reminds me of a quote about the four responses you will get on a linux forum on any question asked:

    1.RTFM
    2.Works for me on version xxx.xx patched with xx.xxx.x
    3.I use emacs.
    4.OMG don't use emacs use vim!

    (Maybe it was funnier in the linux forum ;) )

    As to the OP it is great to learn from terminal but it can be a pain in the @$$ if your just learning. Netbeans is easy to use but first you need to install apples developer tools that come on the second install disk, then install netbeans and it will have the gcc compiler and you wont have to do anything.

    I use netbeans when on my mac and even though I prefer visual studio I dislike the windows OS so unless I am doing something windows specific I use netbeans.
     
  14. ChrisA macrumors G4

    Joined:
    Jan 5, 2006
    Location:
    Redondo Beach, California
    #14
    You can make it even more simple. (1) Use "text edit". It comes with every Mac it is a good enough text editor. (2) Don't even bother with "make", All you need to do is type in your program. All four lines of it. same it is a file called MyFile.c and type "gcc MyFile.c" then to run it type "./a.out" Later, one step at a time add more to your work flow. Work up to using "make" and then later use an IDE if you like. But walk first then run and only later try flying.

    People try to learn to much at once. You can start very simply
     
  15. rich.smith macrumors member

    Joined:
    Aug 21, 2008
    #15
    There are MUCH better FREE alternatives. There is no need to be limited to TextEdit.

    I was assuming that he would want to get beyond the first day.
     
  16. rich.smith macrumors member

    Joined:
    Aug 21, 2008
    #16
    There are MUCH better FREE alternatives. There is no need to be limited to TextEdit.

    I was assuming that he would want to get beyond the first day.
     
  17. zmttoxics macrumors 65816

    zmttoxics

    Joined:
    May 20, 2008
    #17
    Ya, visual studio is nice, but I feel like it babies most users. If you want to learn something, you should get as close as you can to it.

    You can use any text editor you want. I like mcedit in the terminal, but I am a loonie for sure. TextWrangler is one of my favourite graphical ones. To compile, you need to read the man pages on using "g++". To automate the compile, you need to read on how to write a "Makefile". Last but not least, to debug, you need to read on how to use "gdb". It shouldn't take long to do your first hello world, the utilities are all fairly simple with strict syntax and you will know when you did it wrong.
     
  18. pflau macrumors 6502

    Joined:
    Sep 17, 2007
    #18
    You people are just not being helpful. This person is asking for C++ and you guys are either spamming this thread with some BASIC compiler recommendation or ask the person to use command line C++ tool like gcc. Well if you learn using gcc it will be years before you create a blank window in OS X with the line "Hello World" in it I guarantee you that.
     
  19. yeroen macrumors 6502a

    yeroen

    Joined:
    Mar 8, 2007
    Location:
    Cambridge, MA
    #19
    Qt Creator is a new, lightweight, free IDE distributed alongside the (free for noncommercial use) Qt C++ framework. You get syntax highlighting, code completion, push-button build (supporting general make, qmake, and cmake), and an integrated debugger front-end. Qt Creator's editor even has a vi emulation mode for the true believers.

    Unlike syrupy Java IDEs like Eclipse, as a desktop app it's actually usable.
     
  20. lee1210 macrumors 68040

    lee1210

    Joined:
    Jan 10, 2005
    Location:
    Dallas, TX
    #20
    There have been 4 posts that mention XCode, which is the primary IDE for OS X development. The OP asked the difference between XCode and a terminal editor, so this was expounded on a bit.

    I think it's helpful to suggest a broad range of options, it's not going to do any harm. Previous experience with building GUI apps in visual studio may not mean that is all one aspires to, being able to bang out a command line app is considering valuable in some circles.

    -Lee
     
  21. Cerizzle thread starter macrumors member

    Joined:
    May 2, 2009
    Location:
    Atlanta, GA
    #21
    I have XCode now. And i should download VIM?? Or Something else?

    You mean SHE. :)
     
  22. lee1210 macrumors 68040

    lee1210

    Joined:
    Jan 10, 2005
    Location:
    Dallas, TX
    #22
    You already have vim, it or vi are generally installed with any but the sparsest UNIX-like system. If you want to give XCode a go, you won't need both. There's obviously a schism in terms of command-line vs. IDE as you've seen, but you can always try the other later.

    Also, the pronoun "he" can be used when the gender of the subject is unknown, or one is speaking of an unidentified subject. It just happens to be unfortunate for ~51% of the population, though when it comes to programming, sadly the fairer sex is very under-represented. If one were to choose gender specific terms, guessing male is probably right 80-90% of the time. Please don't let the imbalance scare you off, though. Female programmers are badly needed. Especially in a team setting, varying views and approaches are valuable, and one's gender can definitely alter these things. Note that I don't mean this as an excuse for those that might make assumptions (though I don't think that was rich.smith's intent). I only mention this to temper your expectations. Don't type in pink or change your nick to "codergrrrrl", just be prepared for people to "fault male".

    Anyway, get coding. Our petty disputes only get in the way of you developing your skills and learning. Neither approach will irrepairably harm you, so just get to the code.

    -Lee

    Edit: Obviously you were just joking re: the use of "he". It just seemed like a good "in" for that little discussion.
     
  23. Cerizzle thread starter macrumors member

    Joined:
    May 2, 2009
    Location:
    Atlanta, GA
    #23
    Haha! I know. I like working with guys over girls. I was just making fun. :p
    Thanks you guy, you helped out alot.
     
  24. Cerizzle thread starter macrumors member

    Joined:
    May 2, 2009
    Location:
    Atlanta, GA
    #24
    Wont run..

    I cant get it to fun my program.

    I also got TextWranger, Smultron and textmate; and they all wont run my easy program. "//My first program

    #include <iostream>

    using namespace std;

    int main(){


    cout << "Hello World!\n";

    system("Pause");

    }"

    All i want to do is see if it can run, so i can do my really homework with it.
     
  25. zmttoxics macrumors 65816

    zmttoxics

    Joined:
    May 20, 2008
    #25
    Open "Terminal.app", and run:
    Code:
    cd path/to/folder/where/lies/file.cpp
    g++ -o file file.cpp
    ./file
     

Share This Page