Compile commands - Chapter 25 example, for example

Matthew D. Gutchess mdgutchess1@juno.com
Sat Dec 17 22:31:00 GMT 2011


Hi, 
    I just started using (2011 Dec 16) the gcc compiler which was included with Ubuntu 11.04.  Can you include compile commands in your manual?  Compiling the example in Chapter 25 on output buffers, which I called "outbuf1_Josuttis_text.cpp", produced lots of error messages, included below.  Because this program is made for gcc and listed on the gcc website, I figure that I need a more complex "gcc" command with specific references to the locations of libraries.

Thanks, 
Matt Gutchess
mdgutchess1@juno.com

$ gcc outbuf1_Josuttis_text.cpp

/tmp/ccRja833.o: In function `main':
outbuf1_Josuttis_text.cpp:(.text+0x2a): undefined reference to `std::basic_ostream<char, std::char_traits<char> >::basic_ostream(std::basic_streambuf<char, std::char_traits<char> >*)'
outbuf1_Josuttis_text.cpp:(.text+0x3e): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
outbuf1_Josuttis_text.cpp:(.text+0x4b): undefined reference to `std::basic_ostream<char, std::char_traits<char> >::operator<<(std::ios_base& (*)(std::ios_base&))'
outbuf1_Josuttis_text.cpp:(.text+0x58): undefined reference to `std::basic_ostream<char, std::char_traits<char> >::operator<<(int)'
outbuf1_Josuttis_text.cpp:(.text+0x5d): 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> >&)'
outbuf1_Josuttis_text.cpp:(.text+0x65): 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> >&))'
outbuf1_Josuttis_text.cpp:(.text+0x79): undefined reference to `std::basic_ostream<char, std::char_traits<char> >::~basic_ostream()'
outbuf1_Josuttis_text.cpp:(.text+0xa3): undefined reference to `std::basic_ostream<char, std::char_traits<char> >::~basic_ostream()'
/tmp/ccRja833.o: In function `__static_initialization_and_destruction_0(int, int)':
outbuf1_Josuttis_text.cpp:(.text+0xe6): undefined reference to `std::ios_base::Init::Init()'
outbuf1_Josuttis_text.cpp:(.text+0xeb): undefined reference to `std::ios_base::Init::~Init()'
/tmp/ccRja833.o: In function `outbuf::overflow(int)':
outbuf1_Josuttis_text.cpp:(.text._ZN6outbuf8overflowEi[outbuf::overflow(int)]+0x25): undefined reference to `std::basic_streambuf<char, std::char_traits<char> >::getloc() const'
outbuf1_Josuttis_text.cpp:(.text._ZN6outbuf8overflowEi[outbuf::overflow(int)]+0x4b): undefined reference to `std::locale::~locale()'
outbuf1_Josuttis_text.cpp:(.text._ZN6outbuf8overflowEi[outbuf::overflow(int)]+0x7f): undefined reference to `std::locale::~locale()'
/tmp/ccRja833.o: In function `outbuf::outbuf()':
outbuf1_Josuttis_text.cpp:(.text._ZN6outbufC2Ev[_ZN6outbufC5Ev]+0x14): undefined reference to `std::basic_streambuf<char, std::char_traits<char> >::basic_streambuf()'
/tmp/ccRja833.o: In function `outbuf::~outbuf()':
outbuf1_Josuttis_text.cpp:(.text._ZN6outbufD2Ev[_ZN6outbufD5Ev]+0x1f): undefined reference to `std::basic_streambuf<char, std::char_traits<char> >::~basic_streambuf()'
outbuf1_Josuttis_text.cpp:(.text._ZN6outbufD2Ev[_ZN6outbufD5Ev]+0x37): undefined reference to `operator delete(void*)'
/tmp/ccRja833.o: In function `outbuf::~outbuf()':
outbuf1_Josuttis_text.cpp:(.text._ZN6outbufD0Ev[_ZN6outbufD5Ev]+0x20): undefined reference to `operator delete(void*)'
/tmp/ccRja833.o: In function `char std::toupper<char>(char, std::locale const&)':
outbuf1_Josuttis_text.cpp:(.text._ZSt7toupperIcET_S0_RKSt6locale[char std::toupper<char>(char, std::locale const&)]+0x1e): undefined reference to `std::ctype<char> const& std::use_facet<std::ctype<char> >(std::locale const&)'
/tmp/ccRja833.o:(.rodata._ZTV6outbuf[vtable for outbuf]+0x20): undefined reference to `std::basic_streambuf<char, std::char_traits<char> >::imbue(std::locale const&)'
/tmp/ccRja833.o:(.rodata._ZTV6outbuf[vtable for outbuf]+0x28): undefined reference to `std::basic_streambuf<char, std::char_traits<char> >::setbuf(char*, long)'
/tmp/ccRja833.o:(.rodata._ZTV6outbuf[vtable for outbuf]+0x30): undefined reference to `std::basic_streambuf<char, std::char_traits<char> >::seekoff(long, std::_Ios_Seekdir, std::_Ios_Openmode)'
/tmp/ccRja833.o:(.rodata._ZTV6outbuf[vtable for outbuf]+0x38): undefined reference to `std::basic_streambuf<char, std::char_traits<char> >::seekpos(std::fpos<__mbstate_t>, std::_Ios_Openmode)'
/tmp/ccRja833.o:(.rodata._ZTV6outbuf[vtable for outbuf]+0x40): undefined reference to `std::basic_streambuf<char, std::char_traits<char> >::sync()'
/tmp/ccRja833.o:(.rodata._ZTV6outbuf[vtable for outbuf]+0x48): undefined reference to `std::basic_streambuf<char, std::char_traits<char> >::showmanyc()'
/tmp/ccRja833.o:(.rodata._ZTV6outbuf[vtable for outbuf]+0x50): undefined reference to `std::basic_streambuf<char, std::char_traits<char> >::xsgetn(char*, long)'
/tmp/ccRja833.o:(.rodata._ZTV6outbuf[vtable for outbuf]+0x58): undefined reference to `std::basic_streambuf<char, std::char_traits<char> >::underflow()'
/tmp/ccRja833.o:(.rodata._ZTV6outbuf[vtable for outbuf]+0x60): undefined reference to `std::basic_streambuf<char, std::char_traits<char> >::uflow()'
/tmp/ccRja833.o:(.rodata._ZTV6outbuf[vtable for outbuf]+0x68): undefined reference to `std::basic_streambuf<char, std::char_traits<char> >::pbackfail(int)'
/tmp/ccRja833.o:(.rodata._ZTV6outbuf[vtable for outbuf]+0x70): undefined reference to `std::basic_streambuf<char, std::char_traits<char> >::xsputn(char const*, long)'
/tmp/ccRja833.o:(.rodata._ZTI6outbuf[typeinfo for outbuf]+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
/tmp/ccRja833.o:(.rodata._ZTI6outbuf[typeinfo for outbuf]+0x10): undefined reference to `typeinfo for std::basic_streambuf<char, std::char_traits<char> >'
/tmp/ccRja833.o:(.eh_frame+0x12b): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status




More information about the Gcc-help mailing list