List:MySQL++« Previous MessageNext Message »
From:Dale Smith Date:June 13 2005 2:41pm
Subject:Re: Link errors with resetdb example program
View as plain text  
Hi there,

I tried what Warren and Chris suggested. Here are the results:

[dsmith@saquri01 test5]$ make
/opt/gcc/3.4.3/bin/gcc  -c test.cpp -o test.o
/opt/gcc/3.4.3/bin/gcc  -o test test.o -lstdc++
test.o(.gnu.linkonce.t._ZN4TestIcED1Ev+0x112): In function 
`Test<char>::~Test()':
: undefined reference to `std::basic_iostream<char, std::char_traits<char> 
>::~basic_iostream()'
test.o(.gnu.linkonce.t._ZN4TestIcEC1Ev+0x82): In function 
`Test<char>::Test()':
: undefined reference to `std::basic_iostream<char, std::char_traits<char> 
>::basic_iostream(std::basic_streambuf<char, std::char_traits<char> >*)'
test.o(.gnu.linkonce.r._ZTC4TestIcE0_Sd+0x18): undefined reference to 
`std::basic_iostream<char, std::char_traits<char> >::~basic_iostream()'
test.o(.gnu.linkonce.r._ZTC4TestIcE0_Sd+0x28): undefined reference to 
`std::basic_iostream<char, std::char_traits<char> >::~basic_iostream()'
test.o(.gnu.linkonce.t._ZN4TestIcED0Ev+0x112): In function 
`Test<char>::~Test()':
: undefined reference to `std::basic_iostream<char, std::char_traits<char> 
>::~basic_iostream()'
collect2: ld returned 1 exit status
make: *** [test] Error 1

This means I have a problem with libstdc++. I will see what I can do with 
a development version of MySQL++ 2.0. I will email Jonathan Wakely and ask 
him if there was a fix.

Thanks for everyone's help.

Dale Smith, Ph.D.
dalesmith@stripped
DTCC Risk Management
Quantitative Group
212-855-7641




Chris Frey <cdfrey@stripped> 
06/12/2005 05:20 AM

To
plusplus@stripped
cc

Subject
Re: Link errors with resetdb example program






On Fri, Jun 10, 2005 at 03:32:07PM -0600, Warren Young wrote:
> Can you now try linking a basic "hello, world" type program against 
> libmysql++?  If you have to include something in the program to make 
> sure it uses the library, use something peripheral within the library, 
> like string2stream, or some of the primitive C type stuff in convert.h. 
>  You might find the #include graphs in the reference manual helpful 
> here: choose something that doesn't eventually depend on query.h, or 
> even row.h, connection.h, or coldata.h.

I'd recommend using the same program that Jonathan Wakely used in that
earlier thread Warren posted:
                 http://gcc.gnu.org/ml/libstdc++/2004-09/msg00125.html

    #include <istream>
    #include <ostream>

    template <typename C>
    class Test : public std::basic_iostream<C>
    {
    public:
        Test() : std::basic_iostream<C>(0) {}
    };

    #include <iostream>

    int main()
    {
        Test<char> t;
        std::cout << '\n';
    }

The iostream classes were designed with inheritance in mind, so inheriting
(and the destructors) shouldn't cause a problem.


> If the changes to Query will happen, it will 
> happen during the v2.0 development.  It is not yet certain that it will 
> happen, because all known problems presently have reasonable 
> workarounds.  So far, the best reason I have to change it is that Scott 
> Meyers said so.  Not the best reason...

The reason to get rid of stream inheritance would be the copying that
Query objects might do, not the inheritance itself.  And these link errors
all reference the destructor, which doesn't have anything to do with
copying, in my opinion.

Has anyone emailed Jonathan Wakely?  Maybe he would remember what he did
to fix his problem.  The thread doesn't seem to finish completely.

- Chris


-- 
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe:    
http://lists.mysql.com/plusplus?unsub=1



Thread
Link errors with resetdb example programDale Smith8 Jun
  • Re: Link errors with resetdb example programChris Frey8 Jun
    • Re: Link errors with resetdb example programDale Smith8 Jun
      • Re: Link errors with resetdb example programChris Frey8 Jun
        • Re: Link errors with resetdb example programDale Smith8 Jun
        • Re: Link errors with resetdb example programDale Smith8 Jun
          • Re: Link errors with resetdb example programChris Frey9 Jun
  • Re: Link errors with resetdb example programWarren Young9 Jun
    • Re: Link errors with resetdb example programDale Smith9 Jun
    • Re: Link errors with resetdb example programDale Smith10 Jun
      • Re: Link errors with resetdb example programWarren Young10 Jun
        • Re: Link errors with resetdb example programDale Smith10 Jun
          • Re: Link errors with resetdb example programWarren Young10 Jun
            • Re: Link errors with resetdb example programChris Frey12 Jun
              • Re: Link errors with resetdb example programDale Smith13 Jun
              • Re: Link errors with resetdb example programDale Smith13 Jun
              • Re: Link errors with resetdb example programWarren Young13 Jun
                • Re: Link errors with resetdb example programChris Frey14 Jun
                  • Re: Link errors with resetdb example programWarren Young14 Jun