Terminal CC Mode

Discussion in 'Mac Basics and Help' started by Enix18, May 14, 2008.

  1. Enix18 macrumors newbie

    Joined:
    May 14, 2008
    #1
    Here's a simple question: How do you open C++ mode in Terminal?
     
  2. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #2
    What do you mean by C++ mode. The terminal is just a Unix shell.
     
  3. Enix18 thread starter macrumors newbie

    Joined:
    May 14, 2008
    #3
    I thought you could type a certain command to start working in C++, just like you can for Python... (I'm pretty new to this, so I really have no idea)
     
  4. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #4
    No, you write all the code into a file and the call the compiler to turn that into object code. The major difference is that Python is interpreted (so can be used interactively like you are describing), C++ is compiled so cannot be used interactively.
     
  5. Enix18 thread starter macrumors newbie

    Joined:
    May 14, 2008
  6. Roquefort macrumors member

    Joined:
    Apr 29, 2005
    Location:
    U.S. west coast
    #6
    You might have heard of the "C shell". When you use Terminal, you are running a Unix-style shell program. There are various shells in the world, with names like sh, bash, csh, and tcsh. bash is an extended version of sh and tcsh is an extended version of csh, and Mac OS X uses bash and tcsh but calls them sh and csh for backward compatibility reasons.

    csh and tcsh are called C shells because they can execute scripts (executable text files) that use syntax similar to the C programming language. Perhaps that's what you heard about. You aren't in the real C or C++ programming langauge, however.

    If you are already in Terminal, you can enter the tcsh C shell by typing
    Code:
    /bin/csh
    This starts a shell with a shell. To get back out to the original shell, type
    Code:
    exit
    Finally, if you want to, you can set your default Terminal shell to tcsh so launching Terminal will put you directly into a C shell.
     

Share This Page