Обсуждение: [PostgreSQL+SOCI+BOOST] Compile error in core\exchange-traits.h with PG and SOCI on Windows
[PostgreSQL+SOCI+BOOST] Compile error in core\exchange-traits.h with PG and SOCI on Windows
Hi.
This isn’t really a PostgreSQL question but I’ve gotten no response to the following
issue posted on the SOCI-users list. I’m posting here in the hope that someone has
experience building SOCI for PostgreSQL with Boost type support on Windows.
Configuration:
Using SOCI 3.2.3, Boost 1.59.0, PostgreSQL 9.4 (same with 9.5b2),
and Microsoft Visual Studio 2010 on Win 7 Pro 64-bit (everything but OS is 32-bit).
Target is 32-bit SOCI DLL with PostgreSQL support and Boost integration (at least tuple).
Ran 'soci_postgresql_test.exe' and all tests under 'SOCI PostgreSQL Tests' passed except:
test 6 skipped (dynamic backend)
NOTICE: table "soci_test" does not exist, skipping
NOTICE: table "soci_json_test" does not exist, skipping
NOTICE: table "soci_test" does not exist, skipping
I can build an application that doesn't use boost::tuple without error.
However, if I do use boost∷tuple, I get:
c:\develop\soci-3.2.3\core\exchange-traits.h(40): error C2065: 'x_type' : undeclared identifier
// ----example-----------------------------------------------------
#include "stdafx.h"
/* stdafx.h includes:
#define _ITERATOR_DEBUG_LEVEL 0
#include "targetver.h"
#include <stdio.h>
#include <tchar.h>
*/
#include <string>
#include <iostream>
#include <boost/tuple/tuple.hpp>
#include <boost-tuple.h>
#include <soci.h>
#include <soci-postgresql.h>
#pragma comment(lib, "libsoci_core_3_2.lib")
#pragma comment(lib, "libsoci_postgresql_3_2.lib")
#pragma comment(lib, "libpq.lib")
int _tmain(int argc, _TCHAR* argv[])
{
soci::session sql(soci::postgresql, "host=localhost user=postgres password=XXXXX dbname=postgres port=5432");
sql << "CREATE TABLE IF NOT EXISTS t (i INTEGER, s TEXT)";
sql << "TRUNCATE TABLE t";
sql << "INSERT INTO t (i, s) VALUES (0, 'frist')";
int i;
std::string s;
sql << "SELECT i, s FROM t WHERE i = 0", soci::into(i), soci::into(s);
std::cout << i << "\t" << s << std::endl;
boost::tuple<int, std::string> r;
// following line causes error C2065: 'x_type' : undeclared identifier in core\exchange-traits.h
sql << "SELECT i, s FROM t WHERE i = 0", soci::into(r);
std::cout << r.get<0>() << "\t" << r.get<1>() << std::endl;
return(0);
}
//---------------------------------------------------------------------
Thanks.
Brian Lawry
Manufacturing Software Engineer-Supply Chain
Compressor Controls Corporation
4725 121st Street, Des Moines, Iowa 50323, U.S.A.
Вложения
"Lawry, Brian" <blawry@cccglobal.com> writes: > This isn’t really a PostgreSQL question but I’ve gotten no response to the following > issue posted on the SOCI-users list. I’m posting here in the hope that someone has > experience building SOCI for PostgreSQL with Boost type support on Windows. > I can build an application that doesn't use boost::tuple without error. > However, if I do use boost∷tuple, I get: > c:\develop\soci-3.2.3\core\exchange-traits.h(40): error C2065: 'x_type' : undeclared identifier x_type is not a name used anywhere in Postgres, and never has been AFAIK. I'd speculate that the root of your problem is a version mismatch between BOOST and SOCI, but it's only speculation. regards, tom lane
On 12/10/2015 06:55 AM, Lawry, Brian wrote: > Hi. > > This isn’t really a PostgreSQL question but I’ve gotten no response to > the following > > issue posted on the SOCI-users list. I’m posting here in the hope that > someone has > > experience building SOCI for PostgreSQL with Boost type support on Windows. I know nothing about SOCI, but it to help those might, it would be a good idea to detail your build steps. In other words what part of the below did you do? http://soci.sourceforge.net/doc/3.2/installation.html > > Configuration: > > Using SOCI 3.2.3, Boost 1.59.0, PostgreSQL 9.4 (same with 9.5b2), > > and Microsoft Visual Studio 2010 on Win 7 Pro 64-bit (everything but OS > is 32-bit). > > Target is 32-bit SOCI DLL with PostgreSQL support and Boost integration > (at least tuple). > > Ran 'soci_postgresql_test.exe' and all tests under 'SOCI PostgreSQL > Tests' passed except: > > test 6 skipped (dynamic backend) > > NOTICE: table "soci_test" does not exist, skipping > > NOTICE: table "soci_json_test" does not exist, skipping > > NOTICE: table "soci_test" does not exist, skipping > > I can build an application that doesn't use boost::tuple without error. > > However, if I do use boost∷tuple, I get: > > c:\develop\soci-3.2.3\core\exchange-traits.h(40): error C2065: > 'x_type' : undeclared identifier > > // ----example----------------------------------------------------- > > #include "stdafx.h" > > /* stdafx.h includes: > > #define _ITERATOR_DEBUG_LEVEL 0 > > #include "targetver.h" > > #include <stdio.h> > > #include <tchar.h> > > */ > > #include <string> > > #include <iostream> > > #include <boost/tuple/tuple.hpp> > > #include <boost-tuple.h> > > #include <soci.h> > > #include <soci-postgresql.h> > > #pragma comment(lib, "libsoci_core_3_2.lib") > > #pragma comment(lib, "libsoci_postgresql_3_2.lib") > > #pragma comment(lib, "libpq.lib") > > int _tmain(int argc, _TCHAR* argv[]) > > { > > soci::session sql(soci::postgresql, "host=localhost > user=postgres password=XXXXX dbname=postgres port=5432"); > > sql << "CREATE TABLE IF NOT EXISTS t (i INTEGER, s TEXT)"; > > sql << "TRUNCATE TABLE t"; > > sql << "INSERT INTO t (i, s) VALUES (0, 'frist')"; > > int i; > > std::string s; > > sql << "SELECT i, s FROM t WHERE i = 0", soci::into(i), > soci::into(s); > > std::cout << i << "\t" << s << std::endl; > > boost::tuple<int, std::string> r; > > // following line causes error C2065: 'x_type' : undeclared identifier > in core\exchange-traits.h > > sql << "SELECT i, s FROM t WHERE i = 0", soci::into(r); > > std::cout << r.get<0>() << "\t" << r.get<1>() << std::endl; > > return(0); > > } > > //--------------------------------------------------------------------- > > Thanks. > > *Brian Lawry* > > /Manufacturing Software Engineer-Supply Chain/ > > *Compressor Controls Corporation* > > 4725 121^st Street, Des Moines, Iowa 50323, U.S.A. > > blawry@cccglobal.com <mailto:blawry@cccglobal.com>/ www.cccglobal.com > <http://www.cccglobal.com>/ LinkedIn > <http://www.linkedin.com/company/compressor-controls-corporation>__ > -- Adrian Klaver adrian.klaver@aklaver.com
On 12/10/2015 06:55 AM, Lawry, Brian wrote: > Hi. > > This isn’t really a PostgreSQL question but I’ve gotten no response to > the following > > issue posted on the SOCI-users list. I’m posting here in the hope that > someone has Did you see this response?: http://comments.gmane.org/gmane.comp.db.soci.user/2877 Short version is that per Tom Lane's suggestion it is a version mismatch having to with a change in SOCI from 3.2.2 to 3.2.3 and its handling of Boost(in particular tuple). > > experience building SOCI for PostgreSQL with Boost type support on Windows. > > Configuration: > > Using SOCI 3.2.3, Boost 1.59.0, PostgreSQL 9.4 (same with 9.5b2), > > and Microsoft Visual Studio 2010 on Win 7 Pro 64-bit (everything but OS > is 32-bit). > > Target is 32-bit SOCI DLL with PostgreSQL support and Boost integration > (at least tuple). > -- Adrian Klaver adrian.klaver@aklaver.com