>>>>> "LC" == Lennon, Conor <clennon at accuris.ie> writes:
LC> If I do
LC> gcc -c test.cpp
LC> I get no errors, so the problem is in the linking.
LC> If I do
LC> g++ test.cpp
LC> it works. If I run a.out I get 'Hello World'.
When you use gcc to create an executeable, it assumes that you want to
link to the C library. When you use g++, it assumes you want to link
to the C++ standard library. That's why you got all the undefined
references to cout and the ostream methods.
Try "gcc -v" and "g++ -v", to see the differences in the processes
invoked by gcc versus g++.
--
"Weaseling out of things is what separates us from the
animals ... except the weasel."
-- Emad El-Haraty
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!