Getting started with C++ help.

Discussion in 'Mac Programming' started by thestaton, Dec 10, 2007.

  1. thestaton macrumors 6502

    Joined:
    Jan 19, 2006
    #1
    This semester I just finished up intro to programming and we focused on theory and used a little bit of QBasic in windows to learn how to program using top down.

    Next semester I am starting out with the beginning C++ class, so over the Christmas break I wanted to get a head start so I went ahead and purchased the book and am going to attempt to teach myself.

    I remember back when I used FreeBSD I used to code using the equivalent of the terminal, but since I'm using leopard there might be other options.

    I installed xcode off the dvd, but I'm not to sure about it at the moment, I much preferred the different colors I could use in the terminal when writing code.

    So if someone could please help me with what I need to do, to get started I would greatly appreciate it.

    I'm looking for help with:

    Getting started preferably using terminal. But if xcode is better I've not no problem using that.

    Compiling either with terminal or xcode.

    What file do I need to edit if I use terminal to change the colors to my liking?

    Thanks again,
     
  2. iSavant macrumors regular

    Joined:
    Mar 31, 2007
    Location:
    Colorado
    #2
    xcode

    make a small commitment
    to spend the little bit of time

    that would be a worthwhile investment

    good luck in your studies
     
  3. steelphantom macrumors 6502a

    steelphantom

    Joined:
    Oct 15, 2005
    #3
    Well, if you're just writing basic C++ programs, you can use a simple text editor (I like Smultron) and the Terminal with no problems. Write your program in your text editor of choice, and to compile, follow these steps in the Terminal:

    1. To get to your program's directory, type in the following: "cd directory/of/your/program" without quotes. Replace directory/of/your/program with whatever the directory is to your program. For example, "cd Documents/Programming/C++".

    2. To compile your program, type the following, again without quotes: "g++ myprogram -o myprogram.cpp" where myprogram is the name of your program, of course! All C++ source files should be saved with .cpp at the end. This will create an executable file in the same directory as your .cpp file. You can click on it and it will run in the Terminal.

    Hope this wasn't too confusing, and will help get you started! :)
     
  4. ledd macrumors newbie

    Joined:
    Dec 26, 2006
    #4
    Depending on the level of education your currently at...
    Most college institutions will instruct C++ via Linux/Unix with editors like Vi and Emacs. (or in my opinion should) I would suggest starting with emacs and g++ and gcc from the terminal. Full editors like xCode, CodeWarrior, and .Net are numerous and not one is necessarily most popular. Its a safe bet (unless you are on windows) you will always have the same good old emacs and vi. Also, its also good to become familiar with the unix terminal and the many tools it has to offer. Not to mention once you have c++ down using whatever editor you have available will be simple.

    Another plus to for learning c++ and using emacs/vi is that you don't (at least with a default emacs/vi) have auto complete which is very helpful but at the same time having to remember string functions etc... gets them locked in your brain.

    Just as the previous post says you can make your first program very easily with out learning xCode as well.
     

Share This Page