Linker error VS2008 c++ - Mailing list pgsql-general

From Cin123
Subject Linker error VS2008 c++
Date
Msg-id 1320354107421-4962308.post@n5.nabble.com
Whole thread Raw
Responses Re: Linker error VS2008 c++
List 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@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.

pgsql-general by date:

Previous
From: Csaba Nagy
Date:
Subject: Re: Foreign Keys and Deadlocks
Next
From: Cstdenis
Date:
Subject: Distinct on a non-sort column