C++ In Unix

Posted:
in Mac Software edited January 2014
Is there any way to program in C++ in the terminal and then compile from there? I want to use C++ but not Visual C++. Is there any way to do this?



Or if there isn't, are there any non visual C++ programming environments for OS X with compilers?

Comments

  • Reply 1 of 2
    amorphamorph Posts: 7,112member
    Visual C++ is a Microsoft environment. It's not available in any form on OS X.



    You can write vanilla C++ in Project Builder (or CodeWarrior, for that matter) or fire up an editor (GUI or terminal), save and run 'cc <filename.cpp>' on the command line to compile, and './a.out' to run. That's perfectly useful for light work; for more, you want to read the man pages for cc (which is just an alias for gcc) or use Project Builder (which is built around gcc).



    If you want to go 100% command line for whatever reason, the available editors are pico, emacs and vi. More are available for download. I use pico and vi when I bother with a command line editor, but since I'm straying into religion here I'll just recommend that you try them all out and pick one. pico is the easiest to use by far, and also the least powerful - but it's fine for light coding. However, I'd recommend downloading BBEdit Lite if you don't have it already, and using that.



    [ 09-05-2002: Message edited by: Amorph ]</p>
  • Reply 2 of 2
    To be slightly more accurate, to invoke the C++ compiler, the command is "c++" or "g++". "cc" or "gcc" gets you the C compiler. If you use the C compiler on C++ code, the code will compile, but it will be linked with the wrong libraries.
Sign In or Register to comment.