public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Compile commands - Chapter 25 example, for example
@ 2011-12-17 22:31 Matthew D. Gutchess
  2011-12-17 23:04 ` Jonathan Wakely
  0 siblings, 1 reply; 2+ messages in thread
From: Matthew D. Gutchess @ 2011-12-17 22:31 UTC (permalink / raw)
  To: gcc-help

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Compile commands - Chapter 25 example, for example
  2011-12-17 22:31 Compile commands - Chapter 25 example, for example Matthew D. Gutchess
@ 2011-12-17 23:04 ` Jonathan Wakely
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Wakely @ 2011-12-17 23:04 UTC (permalink / raw)
  To: Matthew D. Gutchess; +Cc: gcc-help

On 17 December 2011 22:29, Matthew D. Gutchess wrote:
> 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.

You should use g++ to compile C++ programs instead of gcc, as
explained in the manual under "Compiling C++ Programs"

http://gcc.gnu.org/onlinedocs/gcc/Invoking-G_002b_002b.html

"However, the use of gcc does not add the C++ library. g++ is a
program that calls GCC and treats `.c', `.h' and `.i' files as C++
source files instead of C source files unless -x is used, and
automatically specifies linking against the C++ library."

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-12-17 23:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-17 22:31 Compile commands - Chapter 25 example, for example Matthew D. Gutchess
2011-12-17 23:04 ` Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).