Linker error VS2008 c++

From: Cin123 <a9988768(at)nepwk(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Linker error VS2008 c++
Date: 2011-11-03 21:01:47
Message-ID: 1320354107421-4962308.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi, I'm traing to read a row from a table using visual studio 2008 and libpq.
I'm having problem with getting a int from a querry result, below im pasting
my code

struct subjects_group
{
unsigned long id;
std::string name;
};

list<subjects_group> QS_PQsql::getGroups()
{
list<subjects_group> lista;
subjects_group temp;
char *iptr;

res = PQexec(conn, "SELECT * FROM subjects_group");
if( PQresultStatus(res) != PGRES_TUPLES_OK )
{
PQclear(res);
return lista;
}
iptr = PQgetvalue(res,0,0);

temp.id = ntohl(*(uint32_t*)iptr); //here is line that causing troubles it
gives me a several linker error

temp.name = PQgetvalue(res,0,1);
lista.push_back(temp);

return lista;
}

the errors that i've received:
1>QS_PQsql.obj : error LNK2028: unresolved token (0A000357) "extern "C"
unsigned long __stdcall ntohl(unsigned long)" (?ntohl@@$$J14YGKK(at)Z)
referenced in function "public: class std::list<struct subjects_group,class
std::allocator<struct subjects_group> > __clrcall QS_PQsql::getGroups(void)"
(?getGroups(at)QS_PQsql@@$$FQ$AAM?AV?$list(at)Usubjects_group@@V?$allocator(at)Usubjects_group@@@std@@@std@@XZ)
1>QS_PQsql.obj : error LNK2019: unresolved external symbol "extern "C"
unsigned long __stdcall ntohl(unsigned long)" (?ntohl@@$$J14YGKK(at)Z)
referenced in function "public: class std::list<struct subjects_group,class
std::allocator<struct subjects_group> > __clrcall QS_PQsql::getGroups(void)"
(?getGroups(at)QS_PQsql@@$$FQ$AAM?AV?$list(at)Usubjects_group@@V?$allocator(at)Usubjects_group@@@std@@@std@@XZ)
1>C:\Users\Cin\Documents\Visual Studio 2008\Projects\QS
Queue\Debug\QSserver.exe : fatal error LNK1120: 2 unresolved externals

I needed a stdint.h header because of uint32_t and that header was missing
in vs2008 sa i take it form vs2010

Thanks in advance for any help

--
View this message in context: http://postgresql.1045698.n5.nabble.com/Linker-error-VS2008-c-tp4962308p4962308.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2011-11-03 21:28:34 Re: Strange problem with create table as select * from table;
Previous Message Adrian Klaver 2011-11-03 20:17:25 Re: Strange problem with create table as select * from table;