libpqxx error upon compiling in program

T

txjin

I am new to C++ and was hoping to use it instead of a scripting
language to connect to a database and analyze data.

I have installed libpqxx on my system (RHEL5) and was trying to
compile a program taken from Postgresql 2nd Edition

It would seem that it isn't seeing the pqxx include files or
directories. I think this may be some simple error with regards to an
environment variable or improper include or something like that, but I
have tried variations on the include.

Basically I don't know what I'm doing and looking to see if somebody
else out there with experience with this library could guide me in the
right direction for using it.

------------------------------------------------------------------
#include <stdlib.h>
#include <iostream>
#include <pqxx/pqxx>

using namespace pqxx;
using namespace std;

int main( int argc, const char * argv[] )
{

try
{
connection myConnection( );
myConnection.activate();
}
catch( ... )
{
cerr << "Unknown exception caught" << endl;
exit ( EXIT_FAILURE );
}
exit ( EXIT_SUCCESS );
}
--------------------------------------------------
g++ -Wall -oclient1 client1.cpp

/tmp/ccJCTdbX.o: In function `main':
client1.cpp:(.text+0xa7): undefined reference to
`pqxx::connection_base::activate()'
/tmp/ccJCTdbX.o: In function
`pqxx::connect_direct::connect_direct(std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&)':
client1.cpp:
(.text._ZN4pqxx14connect_directC1ERKSs[pqxx::connect_direct::connect_direct(std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&)]+0x14):
undefined reference to
`pqxx::connectionpolicy::connectionpolicy(std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&)'
client1.cpp:
(.text._ZN4pqxx14connect_directC1ERKSs[pqxx::connect_direct::connect_direct(std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&)]+0x19):
undefined reference to `vtable for pqxx::connect_direct'
/tmp/ccJCTdbX.o: In function
`pqxx::connect_direct::~connect_direct()':
client1.cpp:
(.text._ZN4pqxx14connect_directD1Ev[pqxx::connect_direct::~connect_direct()]
+0x7): undefined reference to `vtable for pqxx::connect_direct'
client1.cpp:
(.text._ZN4pqxx14connect_directD1Ev[pqxx::connect_direct::~connect_direct()]
+0x17): undefined reference to
`pqxx::connectionpolicy::~connectionpolicy()'
/tmp/ccJCTdbX.o: In function
`pqxx::basic_connection<pqxx::connect_direct>::basic_connection(char
const*)':
client1.cpp:
(.text._ZN4pqxx16basic_connectionINS_14connect_directEEC1EPKc[pqxx::basic_connection<pqxx::connect_direct>::basic_connection(char
const*)]+0x18): undefined reference to
`pqxx::connection_base::connection_base(pqxx::connectionpolicy&)'
client1.cpp:
(.text._ZN4pqxx16basic_connectionINS_14connect_directEEC1EPKc[pqxx::basic_connection<pqxx::connect_direct>::basic_connection(char
const*)]+0xb8): undefined reference to `pqxx::connection_base::init()'
/tmp/ccJCTdbX.o: In function
`pqxx::basic_connection<pqxx::connect_direct>::~basic_connection()':
client1.cpp:
(.text._ZN4pqxx16basic_connectionINS_14connect_directEED1Ev[pqxx::basic_connection<pqxx::connect_direct>::~basic_connection()]
+0xf): undefined reference to `pqxx::connection_base::close()'
collect2: ld returned 1 exit status
 
S

Salt_Peter

I am new to C++ and was hoping to use it instead of a scripting
language to connect to a database and analyze data.

I have installed libpqxx on my system (RHEL5) and was trying to
compile a program taken from Postgresql 2nd Edition

It would seem that it isn't seeing the pqxx include files or
directories. I think this may be some simple error with regards to an
environment variable or improper include or something like that, but I
have tried variations on the include.

Basically I don't know what I'm doing and looking to see if somebody
else out there with experience with this library could guide me in the
right direction for using it.
[snip]

Try asking your question here:
http://pqxx.org/development/libpqxx/

In particular, read up on how to link to their libraries.
 
S

Sam

I have installed libpqxx on my system (RHEL5) and was trying to
compile a program taken from Postgresql 2nd Edition

It would seem that it isn't seeing the pqxx include files or
directories. I think this may be some simple error with regards to an
g++ -Wall -oclient1 client1.cpp

/tmp/ccJCTdbX.o: In function `main':
client1.cpp:(.text+0xa7): undefined reference to
`pqxx::connection_base::activate()'

You forgot to explicitly link with libpqxx -- add the -lpqxx parameter.


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)

iD8DBQBHmp5Rx9p3GYHlUOIRAu2mAJ9XZW7o/wNS5KSKv6dhxGCEA0a+CQCeOPXr
W2KpLATeoIBa8OKn5bcFrvU=
=aReb
-----END PGP SIGNATURE-----
 
J

Jack Klein

You forgot to explicitly link with libpqxx -- add the -lpqxx parameter.


--=_mimegpg-commodore.email-scan.com-16019-1201315409-0001
Content-Type: application/pgp-signature
Content-Transfer-Encoding: 7bit

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)

iD8DBQBHmp5Rx9p3GYHlUOIRAu2mAJ9XZW7o/wNS5KSKv6dhxGCEA0a+CQCeOPXr
W2KpLATeoIBa8OKn5bcFrvU=
=aReb
-----END PGP SIGNATURE-----

--=_mimegpg-commodore.email-scan.com-16019-1201315409-0001--

Please stop posting mime encoded gibberish to text-only usenet groups.
Thank you.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://c-faq.com/
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.club.cc.cmu.edu/~ajo/docs/FAQ-acllc.html
 
S

Sam

Jack said:
Please stop posting mime encoded gibberish to text-only usenet groups.
Thank you.

Please stop blaming everyone else for the well-known bugs in your shitty
newsreader.


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)

iD8DBQBHmri8x9p3GYHlUOIRAtH7AJ4jyR5mxy41aonhlS2su3MoRNsRngCfTmpa
36LhraIgAipQEsn0moyOgJ4=
=6fML
-----END PGP SIGNATURE-----
 
C

clarkhorse6

On Jan 25, 9:08 pm, (e-mail address removed) wrote:> I am new to C++ and was hoping to use it instead of a scripting
language to connect to a database and analyze data.
I have installed libpqxx on my system (RHEL5) and was trying to
compile a program taken from Postgresql 2nd Edition
It would seem that it isn't seeing the pqxx include files or
directories. I think this may be some simple error with regards to an
environment variable or improper include or something like that, but I
have tried variations on the include.
Basically I don't know what I'm doing and looking to see if somebody
else out there with experience with this library could guide me in the
right direction for using it.

[snip]

Try asking your question here:http://pqxx.org/development/libpqxx/

In particular, read up on how to link to their libraries.

Thanks,
There were some things there that I still don't completely understand,
but I am able to compile without errors now. Hopefully as I go along
and learn C++ this will become a little easier to understand. I kind
of paniced today when I thought that the main reason for me learning C+
+ wasn't going to work. I had spent quite a bit of time installing rpm
and then installing from source and trying different hacks. WOOOh
I rest a little easier Thanks again.
 
C

clarkhorse6

You forgot to explicitly link with libpqxx -- add the -lpqxx parameter.

application_pgp-signature_part
1KDownload


Thanks,
That worked. I am able to compile without errors now. Hopefully as I
go along and learn C++ this will become a little easier to
understand. I kind of paniced today when I thought that the main
reason for me learning C++ wasn't going to work. I had spent quite a
bit of time installing rpm and then installing from source and trying
different hacks. WOOOh
I'll rest a little easier Thanks again.
 
J

Jack Klein

Please stop blaming everyone else for the well-known bugs in your shitty
newsreader.

There are no bugs in my newsreader, at least not any that pertain to
what you are talking about.

Most usenet groups without .binary in their names are text-only. Mime
encoded anything is not text-only.

Loop up one of the posts with the subject "===Welcome to
comp.lang.c++! Read this first." posted to this group periodically,
and not by me. While it does not specifically mention mime encoding,
only HTML, I think you can get the idea.

While PGP just might have its uses for email, it is complete and utter
nonsense for usenet.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://c-faq.com/
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.club.cc.cmu.edu/~ajo/docs/FAQ-acllc.html
 
S

Sam

Jack said:
There are no bugs in my newsreader, at least not any that pertain to
what you are talking about.

You are incorrect. This is a well-known bug in your MS Windows bugware:
failure to implement a ten-year old Internet standard for digitally-signed
messages.
Most usenet groups without .binary in their names are text-only. Mime
encoded anything is not text-only.

Sorry to confuse you with facts, but MIME is not just concerned with binary
attachments.

In fact, your message is a MIME message, so please stop posting binaries to
this newsgroup.


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)

iD8DBQBHm9r2x9p3GYHlUOIRAlBeAJ9lBYZwWE0OQFgWInCwVLYKCz88LACfTI2P
mpyYZOXOoVRdeH8PU536v9w=
=JNAV
-----END PGP SIGNATURE-----
 
J

Jerry Coffin

[ ... ]
You are incorrect. This is a well-known bug in your MS Windows bugware:
failure to implement a ten-year old Internet standard for digitally-signed
messages.

Wrong (yet again!). First of all, if you'd bothered to read the headers,
you would have seen that the software Jack is using is not from
Microsoft. Second, there is NO standard for digitally signing USENET
posts.
Sorry to confuse you with facts, but MIME is not just concerned with binary
attachments.

No, but it IS just concerned with _mail_, not Usenet posts. Perhaps you
hadn't noticed that "MIME" stands for multipurpose Internet MAIL
extensions?
In fact, your message is a MIME message, so please stop posting binaries to
this newsgroup.

Still more nonsense. The fact that MIME can be used to send plain text
does NOT mean that all plain text is MIME, any more than the fact that
some rivers are polluted means all water is undrinkable. Your argument
is fallacious and nonsensical.

This newsgroup is devoted to programming, a field in which logical
reasoning is an absolute necessity. Your failure to grasp such
fundamentals in reasoning along with your failure to understand the
fundamental difference between mail and USENET posts reflects poorly on
your potential as a programmer.
 
A

Alf P. Steinbach

* Jerry Coffin:
[ ... ]
You are incorrect. This is a well-known bug in your MS Windows bugware:
failure to implement a ten-year old Internet standard for digitally-signed
messages.

Wrong (yet again!). First of all, if you'd bothered to read the headers,
you would have seen that the software Jack is using is not from
Microsoft. Second, there is NO standard for digitally signing USENET
posts.
Sorry to confuse you with facts, but MIME is not just concerned with binary
attachments.

No, but it IS just concerned with _mail_, not Usenet posts. Perhaps you
hadn't noticed that "MIME" stands for multipurpose Internet MAIL
extensions?
In fact, your message is a MIME message, so please stop posting binaries to
this newsgroup.

Still more nonsense. The fact that MIME can be used to send plain text
does NOT mean that all plain text is MIME, any more than the fact that
some rivers are polluted means all water is undrinkable. Your argument
is fallacious and nonsensical.

This newsgroup is devoted to programming, a field in which logical
reasoning is an absolute necessity. Your failure to grasp such
fundamentals in reasoning along with your failure to understand the
fundamental difference between mail and USENET posts reflects poorly on
your potential as a programmer.

I think "Sam" is wrong in the main, by posting to clc++ with a format
that some newsreaders don't support (Thunderbird handles it, btw.).

It's akin to insisting on using "export" in C++ code that's meant to be
compiled by others.

But regarding the fine technical points, whether PGP signatures are
technically well-defined for Usenet postings, Erik Naggum, who is
something of a fanatical "stick to the technically correct" and seldom
wrong about the technical, posts or used to post with PGP signature.


Cheers,

- Alf
 
S

Sam

Jerry said:
[ ... ]
You are incorrect. This is a well-known bug in your MS Windows bugware:
failure to implement a ten-year old Internet standard for digitally-signed
messages.

Wrong (yet again!). First of all, if you'd bothered to read the headers,
you would have seen that the software Jack is using is not from
Microsoft.

Where did I say that his software was written by Microsoft? Reading
comprehension does not appear to be your strength, does it? I wrote "MS
Windows", as in "Microsoft Windows", as in "operating system". Not
everything on the MS Windows platform is written by Microsoft, did you know
that?
Second, there is NO standard for digitally signing USENET
posts.

Yes, there is. See RFC 2015.
No, but it IS just concerned with _mail_, not Usenet posts. Perhaps you
hadn't noticed that "MIME" stands for multipurpose Internet MAIL
extensions?

Perhaps you've noticed that your TARDIS is long overdue for a service check,
and it seems to be permanently stuck in the 1990's.

http://www.tcpipguide.com/free/t_UsenetMessageFormatandSpecialHeaders-3.htm

[ Since Usenet follows the RFC 822 standard, Multipurpose Internet Mail
Extensions (MIME) can be used to format Usenet messages. … ]

I love arguing Internet standards with raw newbies, who think they're hot
shit just because they figured out their NNTP server's IP address.

Besides, your very own headers read:

MIME-Version: 1.0

So please stop posting MIME to Usenet, sir. After all MIME does not belong
on Usenet.
Still more nonsense. The fact that MIME can be used to send plain text
does NOT mean that all plain text is MIME, any more than the fact that
some rivers are polluted means all water is undrinkable. Your argument
is fallacious and nonsensical.

Tell you what: when you've written server software that processes MIME
content, that's used by thousands of organizations worldwide, then you
can lecture me on what MIME is or isn't.

Until then, you can be safely written off as just another quack who is
obviously embarassed for being forced to used buggy newsreader, but instead
of getting his newsreader fixed, he demands that people stop posting
messages that his software cannot handle properly.
This newsgroup is devoted to programming, a field in which logical
reasoning is an absolute necessity. Your failure to grasp such
fundamentals in reasoning along with your failure to understand the
fundamental difference between mail and USENET posts reflects poorly on
your potential as a programmer.

Indeed -- you're definitely, hands down, a poster child for logical
thinking.


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)

iD8DBQBHnLwTx9p3GYHlUOIRAqUqAJ9Ps3UgHIRdpeG4FQobF5i4CDhAagCfcW1k
ORbpkh2TSJpT4PBeloTq3y4=
=0QyW
-----END PGP SIGNATURE-----
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top