我刚刚安装了 libpqxx(用于 c++ 的 postgresql)。我正在关注本教程:http ://www.tutorialspoint.com/postgresql/postgresql_c_cpp.htm 一切都很好,少一件事。当我尝试编译示例代码时,我看到了所有这些错误:
/home/JakisUzytkownik/Hobby/C++/DzialaNaUbuntu.o||In function `main':|
DzialaNaUbuntu.cpp|| undefined reference to `pqxx::connection_base::is_open() const'|
DzialaNaUbuntu.cpp|| undefined reference to `pqxx::connection_base::dbname()'|
DzialaNaUbuntu.cpp|| undefined reference to `pqxx::connection_base::disconnect()'|
/home/marcwel/Hobby/C++/DzialaNaUbuntu.o||In function `pqxx::connect_direct::connect_direct(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':|
DzialaNaUbuntu.cpp:(.text._ZN4pqxx14connect_directC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZN4pqxx14connect_directC5ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x1f)||undefined reference to `pqxx::connectionpolicy::connectionpolicy(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'|
DzialaNaUbuntu.cpp:(.text._ZN4pqxx14connect_directC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZN4pqxx14connect_directC5ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x24)||undefined reference to `vtable for pqxx::connect_direct'|
/home/marcwel/Hobby/C++/DzialaNaUbuntu.o||In function `pqxx::connect_direct::~connect_direct()':|
DzialaNaUbuntu.cpp:(.text._ZN4pqxx14connect_directD2Ev[_ZN4pqxx14connect_directD5Ev]+0xd)||undefined reference to `vtable for pqxx::connect_direct'|
DzialaNaUbuntu.cpp:(.text._ZN4pqxx14connect_directD2Ev[_ZN4pqxx14connect_directD5Ev]+0x20)||undefined reference to `pqxx::connectionpolicy::~connectionpolicy()'|
/home/marcwel/Hobby/C++/DzialaNaUbuntu.o||In function `pqxx::basic_connection<pqxx::connect_direct>::basic_connection(char const*)':|
DzialaNaUbuntu.cpp:(.text._ZN4pqxx16basic_connectionINS_14connect_directEEC2EPKc[_ZN4pqxx16basic_connectionINS_14connect_directEEC5EPKc]+0x38)||undefined reference to `pqxx::connection_base::connection_base(pqxx::connectionpolicy&)'|
DzialaNaUbuntu.cpp:(.text._ZN4pqxx16basic_connectionINS_14connect_directEEC2EPKc[_ZN4pqxx16basic_connectionINS_14connect_directEEC5EPKc]+0xc3)||undefined reference to `pqxx::connection_base::init()'|
/home/marcwel/Hobby/C++/DzialaNaUbuntu.o||In function `pqxx::basic_connection<pqxx::connect_direct>::~basic_connection()':|
DzialaNaUbuntu.cpp:(.text._ZN4pqxx16basic_connectionINS_14connect_directEED2Ev[_ZN4pqxx16basic_connectionINS_14connect_directEED5Ev]+0x17)||undefined reference to `pqxx::connection_base::close()'|
IDE:代码块,操作系统:Ubuntu