How to compile C sources using terminal?

Hi,

I've just started to learn bash and c++, so forgive me if my question is too lame.
I want to know how to compile a source file using terminal.

I tried: gcc hello.cpp
but I got this message:

Undefined symbols:
"___gxx_personality_v0", referenced from:
___gxx_personality_v0$non_lazy_ptr in ccC688qk.o
"std::ios_base::Init::~Init()", referenced from:
___tcf_0 in ccC688qk.o
"std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)", referenced from:
_main in ccC688qk.o
"std::ios_base::Init::Init()", referenced from:
__static_initialization_and_destruction_0(int, int)in ccC688qk.o
"std::cout", referenced from:
__ZSt4cout$non_lazy_ptr in ccC688qk.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

What do I have to do to make things go in the right direction?

Thanks in advance

iMac 2.66 GHz 2 GB, Mac OS X (10.5.5), XCode 3.1.1

Posted on Nov 3, 2008 10:10 AM

Reply
2 replies

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

How to compile C sources using terminal?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.