class std::auto_ptr’ is deprecated while trying to compile with mysql++ library

989 Views Asked by At

I'm facing a compilation problem while trying to use mysql++.h in my C++ program on an ASUS Tinker Board.

Includes look like this :

#include <mysql++.h>
#include <stdlib.h>

G++ command executed is this one :

g++ -I/usr/include/mysql -I/usr/include/mysql++ -L/usr/lib -lmysqlpp -lmysqlclient mysql.c -o mysql

Output contains the following :

In file included from /usr/include/mysql++/sql_buffer.h:31:0,
                 from /usr/include/mysql++/stadapter.h:35,
                 from /usr/include/mysql++/qparms.h:35,
                 from /usr/include/mysql++/query.h:35,
                 from /usr/include/mysql++/mysql++.h:58,
                 from mysql.c:1:
/usr/include/mysql++/refcounted.h: In constructor ‘mysqlpp::RefCountedPointer<T, Destroyer>::RefCountedPointer(T*)’:
/usr/include/mysql++/refcounted.h:104:8: warning: ‘template<class> class std::auto_ptr’ is deprecated [-Wdeprecated-declarations]
   std::auto_ptr<T> exception_guard(counted_);
        ^~~~~~~~
In file included from /usr/include/c++/6/memory:81:0,
                 from /usr/include/mysql++/refcounted.h:31,
                 from /usr/include/mysql++/sql_buffer.h:31,
                 from /usr/include/mysql++/stadapter.h:35,
                 from /usr/include/mysql++/qparms.h:35,
                 from /usr/include/mysql++/query.h:35,
                 from /usr/include/mysql++/mysql++.h:58,
                 from mysql.c:1:
/usr/include/c++/6/bits/unique_ptr.h:49:28: note: declared here
   template<typename> class auto_ptr;
                            ^~~~~~~~

I tried to modify file "/refcounted.h" by changing "std::auto_ptr" by "std::unique_ptr", it compiles successfully, but I get a "Segmentation fault" while trying to run my program.

Please help, thanks.

0

There are 0 best solutions below