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
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