Search Postgresql Archives

Linker error VS2008 c++

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@Z)
referenced in function "public: class std::list<struct subjects_group,class
std::allocator<struct subjects_group> > __clrcall QS_PQsql::getGroups(void)"
(?getGroups@QS_PQsql@@$$FQ$AAM?AV?$list@Usubjects_group@@V?$allocator@Usubjects_group@@@std@@@std@@XZ)
1>QS_PQsql.obj : error LNK2019: unresolved external symbol "extern "C"
unsigned long __stdcall ntohl(unsigned long)" (?ntohl@@$$J14YGKK@Z)
referenced in function "public: class std::list<struct subjects_group,class
std::allocator<struct subjects_group> > __clrcall QS_PQsql::getGroups(void)"
(?getGroups@QS_PQsql@@$$FQ$AAM?AV?$list@Usubjects_group@@V?$allocator@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.

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux