Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: itsols on June 30, 2013, 09:16:46 am

Title: libpqxx simple connection to database
Post by: itsols on June 30, 2013, 09:16:46 am
I'm trying to make my first db program and I've tried this:

Code
#include <pqxx/pqxx>
#include <iostream>

using namespace std;
int main()
{

    pqxx::connection MyConn ("dbname=dbESM user=postgres");
    //pqxx::work txn(MyConn);


    cout << "Hello world!" << endl;

    return 0;
}
But I get the following error on hitting F9:
Quote
/usr/include/pqxx/connection.hxx|87|undefined reference to pqxx::connectionpolicy::connectionpolicy(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
I'm not sure how to get about this. Any help would be really appreciated.

I'm using Ubuntu 12.04.
Thanks!
Title: Re: libpqxx simple connection to database
Post by: oBFusCATed on June 30, 2013, 10:30:04 am
http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3F
http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28errors%29#Q:_What_do_I_need_to_know_when_using_3rd_party_libs.3F
Title: SOLVED: libpqxx simple connection to database
Post by: itsols on July 01, 2013, 03:10:42 pm
Thanks for the inputs. I found the instructions useful.

I also had some good instructions from another site and that was really helpful in solving the issue. Here's the link: http://stackoverflow.com/questions/17386598/simple-c-program-using-pqxx-postgres/17391793#17391793 (http://stackoverflow.com/questions/17386598/simple-c-program-using-pqxx-postgres/17391793#17391793)