Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   C++ (http://www.programmingforums.org/forum15.html)
-   -   C++ and libpqxx (http://www.programmingforums.org/showthread.php?t=59)

Pizentios Jun 15th, 2004 2:39 PM

Hey,

i am trying to write a little program to look at some values in a postgresql db and then send a email out if the values are at a certin level. Anyways, i needed a c++ interface to postgresql so i downloaded libpqxx and installed it. I did the make check that the readme tells you to do right before the make install. All 81 test passed. I tryed just setting up a connection to the db as per the tutorial, like this:
:

#include <pqxx/connection.h>
using namespace pqxx;

int main()
{
    connection Conn("dbname=proform");
    return 0;
}


Anyways, when i try compiling it like this:
Quote:


g++ -o test main.cpp

all i get is just a bunch of syntax errors that are pointing at the header files that i call when i include the file connection. Now i am sure that it just has somthing to do with me not declairing somthing right or some enviroment error that i don't know about. Here are the compiler errors that it spits out:

Quote:


In file included from /usr/local/include/pqxx/util:21,
* * * * * * * * from /usr/local/include/pqxx/except.hxx:22,
* * * * * * * * from /usr/local/include/pqxx/except:22,
* * * * * * * * from /usr/local/include/pqxx/connection_base.hxx:27,
* * * * * * * * from /usr/local/include/pqxx/connection_base:22,
* * * * * * * * from /usr/local/include/pqxx/connection.hxx:19,
* * * * * * * * from /usr/local/include/pqxx/connection:22,
* * * * * * * * from main.cpp:1:
/usr/local/include/pqxx/util.hxx:28:22: libpq-fe.h: No such file or directory
In file included from /usr/local/include/pqxx/util:21,
* * * * * * * * from /usr/local/include/pqxx/except.hxx:22,
* * * * * * * * from /usr/local/include/pqxx/except:22,
* * * * * * * * from /usr/local/include/pqxx/connection_base.hxx:27,
* * * * * * * * from /usr/local/include/pqxx/connection_base:22,
* * * * * * * * from /usr/local/include/pqxx/connection.hxx:19,
* * * * * * * * from /usr/local/include/pqxx/connection:22,
* * * * * * * * from main.cpp:1:
/usr/local/include/pqxx/util.hxx:39: syntax error before `;' token
/usr/local/include/pqxx/util.hxx:42: syntax error before `=' token
/usr/local/include/pqxx/util.hxx:390: `PGnotify' was not declared in this scope
/usr/local/include/pqxx/util.hxx:390: syntax error before `)' token
/usr/local/include/pqxx/util.hxx:465: `PGnotify' was not declared in this scope
/usr/local/include/pqxx/util.hxx:465: template argument 1 is invalid
/usr/local/include/pqxx/util.hxx:466: non-template used as template
/usr/local/include/pqxx/util.hxx:466: syntax error before `{' token
/usr/local/include/pqxx/util.hxx:527: syntax error before `}' token
In file included from /usr/local/include/pqxx/connection_base:22,
* * * * * * * * from /usr/local/include/pqxx/connection.hxx:19,
* * * * * * * * from /usr/local/include/pqxx/connection:22,
* * * * * * * * from main.cpp:1:
/usr/local/include/pqxx/connection_base.hxx:319: syntax error before `*' token
/usr/local/include/pqxx/connection_base.hxx:322: semicolon missing after
* declaration of `pqxx::connection_base'
/usr/local/include/pqxx/connection_base.hxx: In member function `pqxx::noticer*
* pqxx::connection_base::get_noticer() const':
/usr/local/include/pqxx/connection_base.hxx:136: `m_Noticer' undeclared (first
* use this function)
/usr/local/include/pqxx/connection_base.hxx:136: (Each undeclared identifier is
* reported only once for each function it appears in.)
/usr/local/include/pqxx/connection_base.hxx: In member function `const char*
* pqxx::connection_base::dbname()':
/usr/local/include/pqxx/connection_base.hxx:157: `halfconnect' undeclared
* (first use this function)
/usr/local/include/pqxx/connection_base.hxx:157: `m_Conn' undeclared (first use
* this function)
/usr/local/include/pqxx/connection_base.hxx:157: `PQdb' undeclared (first use
* this function)
/usr/local/include/pqxx/connection_base.hxx: In member function `const char*
* pqxx::connection_base::username()':
/usr/local/include/pqxx/connection_base.hxx:161: `PQuser' undeclared (first use
* this function)
/usr/local/include/pqxx/connection_base.hxx: In member function `const char*
* pqxx::connection_base::hostname()':
/usr/local/include/pqxx/connection_base.hxx:165: `PQhost' undeclared (first use
* this function)
/usr/local/include/pqxx/connection_base.hxx: In member function `const char*
* pqxx::connection_base::port()':
/usr/local/include/pqxx/connection_base.hxx:169: `PQport' undeclared (first use
* this function)
/usr/local/include/pqxx/connection_base.hxx: In member function `const char*
* pqxx::connection_base::options() const':
/usr/local/include/pqxx/connection_base.hxx:173: `m_ConnInfo' undeclared (first
* use this function)
/usr/local/include/pqxx/connection_base.hxx: In member function `int
* pqxx::connection_base::backendpid() const':
/usr/local/include/pqxx/connection_base.hxx:185: `PQbackendPID' undeclared
* (first use this function)
/usr/local/include/pqxx/connection_base.hxx: At global scope:
/usr/local/include/pqxx/connection_base.hxx:322: `PGconn' was not declared in
* this scope
/usr/local/include/pqxx/connection_base.hxx:322: `C' was not declared in this
* scope
/usr/local/include/pqxx/connection_base.hxx:322: ISO C++ forbids defining types
* within return type
/usr/local/include/pqxx/connection_base.hxx:322: two or more data types in
* declaration of `set_conn'
/usr/local/include/pqxx/connection_base.hxx:322: cannot declare variable `
* pqxx::set_conn' to be of type `pqxx::connection_base'
/usr/local/include/pqxx/connection_base.hxx:322:* because the following
* virtual functions are abstract:
/usr/local/include/pqxx/connection_base.hxx:313:* * * * virtual void
* pqxx::connection_base::completeconnect()
/usr/local/include/pqxx/connection_base.hxx:310:* * * * virtual void
* pqxx::connection_base::startconnect()
/usr/local/include/pqxx/connection_base.hxx:97:* * * * virtual
* pqxx::connection_base::~connection_base()
/usr/local/include/pqxx/connection_base.hxx:322: syntax error before `{' token
/usr/local/include/pqxx/connection_base.hxx:324: non-member function `void
* wait_read()' cannot have `const' method qualifier
/usr/local/include/pqxx/connection_base.hxx:325: non-member function `void
* wait_read(long int, long int)' cannot have `const' method qualifier
/usr/local/include/pqxx/connection_base.hxx:326: non-member function `void
* wait_write()' cannot have `const' method qualifier
/usr/local/include/pqxx/connection_base.hxx:328: syntax error before `private'
/usr/local/include/pqxx/connection_base.hxx:331: non-member function `int
* Status()' cannot have `const' method qualifier
/usr/local/include/pqxx/connection_base.hxx: In function `int Status()':
/usr/local/include/pqxx/connection_base.hxx:331: `m_Conn' undeclared (first use
* this function)
/usr/local/include/pqxx/connection_base.hxx:331: `PQstatus' undeclared (first
* use this function)
/usr/local/include/pqxx/connection_base.hxx: At global scope:
/usr/local/include/pqxx/connection_base.hxx:332: non-member function `const
* char* ErrMsg()' cannot have `const' method qualifier
/usr/local/include/pqxx/connection_base.hxx:337: non-member function `int
* set_fdmask()' cannot have `const' method qualifier
/usr/local/include/pqxx/connection_base.hxx:349: syntax error before `*' token
/usr/local/include/pqxx/connection_base.hxx:351: syntax error before `::' token
/usr/local/include/pqxx/connection_base.hxx:354: `noticer' was not declared in
* this scope
/usr/local/include/pqxx/connection_base.hxx:354: template argument 1 is invalid
/usr/local/include/pqxx/connection_base.hxx:365: non-member `m_fdmask' cannot
* be declared `mutable'
/usr/local/include/pqxx/connection_base.hxx:367: `friend' can only be specified
* inside a class
/usr/local/include/pqxx/connection_base.hxx:368: syntax error before `char'
/usr/local/include/pqxx/connection_base.hxx:371: `result' was not declared in
* this scope
/usr/local/include/pqxx/connection_base.hxx:371: syntax error before `,' token
/usr/local/include/pqxx/connection_base.hxx:376: syntax error before `*' token
/usr/local/include/pqxx/connection_base.hxx:381: `friend' can only be specified
* inside a class
/usr/local/include/pqxx/connection_base.hxx:382: syntax error before `*' token
/usr/local/include/pqxx/connection_base.hxx:384: `friend' can only be specified
* inside a class
/usr/local/include/pqxx/connection_base.hxx:389: syntax error before `&' token
/usr/local/include/pqxx/connection_base.hxx:390: syntax error before `&' token

Anyways, i don't think that it's the lib's that i am trying to use, i think it's ether a linking problem, or somthing else that's way way over my head. Heh, maybe this c++ program is too.... ;-) i guess that's how i learn things or somthing. Anyways, if sombody can spot what the hell is going on, great, or if anybody has some links to some better documentation than what comes with the tar ball that would be great too. Anyways thanks for help in advance.

aukahi Jun 16th, 2004 10:53 PM

well the compiler is complaining that it couldn't find some include files.
i think you are missing the libpq library. in the requirements for libpqxx, it says that libpqxx is build on top of libpq, so you need libpq installed.

Pizentios Jun 17th, 2004 8:44 AM

Hey, thanks for your reply. That's what i was kinda thinking too, although i do have libpq installed already. i think it might just have gotten installed in the wrong dir. I'll let you guys now if that was the problem.

-Pizentios


All times are GMT -5. The time now is 4:44 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC