Compiling simple Hello World program on OS X via command line Compiling simple Hello World program on OS X via command line xcode xcode

Compiling simple Hello World program on OS X via command line


Try

g++ hw.cpp./a.out

g++ is the C++ compiler frontend to GCC.
gcc is the C compiler frontend to GCC.

Yes, Xcode is definitely an option. It is a GUI IDE that is built on-top of GCC.

Though I prefer a slightly more verbose approach:

#include <iostream>int main(){    std::cout << "Hello world!" << std::endl;}


user@host> g++ hw.cppuser@host> ./a.out