I've been trying to compile some code.  When I type the following in
the command line, I get a bunch of errors:

[EMAIL PROTECTED]:/imports/home/cspears/Documents/C++/myCode/chap04/ex04>
gcc struct.cpp test.cpp
/tmp/ccZ4eruw.o(.text+0x29): In function `Simple::displayInt()':
: undefined reference to `std::cout'
/tmp/ccZ4eruw.o(.text+0x2e): In function `Simple::displayInt()':
: undefined reference to `std::basic_ostream<char,
std::char_traits<char> >::operator<<(int)'
/tmp/ccZ4eruw.o(.text+0x36): In function `Simple::displayInt()':
: undefined reference to `std::basic_ostream<char,
std::char_traits<char> >& std::endl<char, std::char_traits<char>
>(std::basic_ostream<char, std::char_traits<char> >&)'
/tmp/ccZ4eruw.o(.text+0x3b): In function `Simple::displayInt()':
: undefined reference to `std::basic_ostream<char,
std::char_traits<char> >::operator<<(std::basic_ostream<char,
std::char_traits<char> >& (*)(std::basic_ostream<char,
std::char_traits<char> >&))'
/tmp/ccZ4eruw.o(.text+0x65): In function
`__static_initialization_and_destruction_0(int, int)':
: undefined reference to `std::ios_base::Init::Init[in-charge]()'
/tmp/ccZ4eruw.o(.text+0x92): In function `__tcf_0':
: undefined reference to `std::ios_base::Init::~Init [in-charge]()'
/tmp/ccZ4eruw.o(.eh_frame+0x11): undefined reference to
`__gxx_personality_v0'
/tmp/cc79ghVK.o(.text+0x49): In function
`__static_initialization_and_destruction_0(int, int)':
: undefined reference to `std::ios_base::Init::Init[in-charge]()'
/tmp/cc79ghVK.o(.text+0x76): In function `__tcf_0':
: undefined reference to `std::ios_base::Init::~Init [in-charge]()'
/tmp/cc79ghVK.o(.eh_frame+0x11): undefined reference to
`__gxx_personality_v0'
collect2: ld returned 1 exit status

However, when I type g++, everything works well:

[EMAIL PROTECTED]:/imports/home/cspears/Documents/C++/myCode/chap04/ex04>
g++ struct.cpp test.cpp
[EMAIL PROTECTED]:/imports/home/cspears/Documents/C++/myCode/chap04/ex04>
ls
a.out  struct.cpp  struct.cpp~  struct.h  struct.h~  test.cpp
test.cpp~
[EMAIL PROTECTED]:/imports/home/cspears/Documents/C++/myCode/chap04/ex04>
./a.out
5

Why is this?  I thought g++ and gcc were the same.

_______________________________________________
Help-gplusplus mailing list
Help-gplusplus@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gplusplus

Reply via email to