eintyp
Goto Top

PostGreSQL - Fehler beim Kompilieren

Hallo Community,

als ich versuchte folgenden Code zu kompilieren bekam ich merkwürdige Fehler, welche anscheinend entstehen wenn mehrere Boost-Versionen installiert sind. Aber wie schaffe ich es das Programm trotzdem zu kompilieren?

DatabaseHandler.h
#ifndef DATABASEHANDLER_H_
#define DATABASEHANDLER_H_

#include <pqxx/connection.hxx>

#include "global.h" 

class DatabaseHandler {
public:
	DatabaseHandler(settings_zm& settings);
	virtual ~DatabaseHandler();
	void close();
};

#endif {{comment_multi_line:0}}

DatabaseHandler.cpp
#include "DatabaseHandler.h" 

DatabaseHandler::DatabaseHandler(settings_zm& settings) {
	pqxx::connection Conn("hostaddr=127.0.0.1 user=usernam password=1234 dbname=test");  
}

DatabaseHandler::~DatabaseHandler() {
	this->close();
}

void DatabaseHandler::close() {
}

Ausgabe:
Build of configuration Debug for project test ****

make all
Building file: ../src/DatabaseHandler.cpp
Invoking: Cygwin C++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/DatabaseHandler.d" -MT"src/DatabaseHandler.d" -o "src/DatabaseHandler.o" "../src/DatabaseHandler.cpp"
Finished building: ../src/DatabaseHandler.cpp

Building file: ../src/global.cpp
Invoking: Cygwin C++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/global.d" -MT"src/global.d" -o "src/global.o" "../src/global.cpp"
Finished building: ../src/global.cpp

Building file: ../src/main.cpp
Invoking: Cygwin C++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/main.d" -MT"src/main.d" -o "src/main.o" "../src/main.cpp"
Finished building: ../src/main.cpp

Building file: ../src/main_utils.cpp
Invoking: Cygwin C++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/main_utils.d" -MT"src/main_utils.d" -o "src/main_utils.o" "../src/main_utils.cpp"
Finished building: ../src/main_utils.cpp

Building target: test.exe
Invoking: Cygwin C++ Linker
g++ -o "test.exe" ./src/DatabaseHandler.o ./src/global.o ./src/main.o ./src/main_utils.o
./src/DatabaseHandler.o: In function `__static_initialization_and_destruction_0':
/usr/include/boost/system/error_code.hpp:214: undefined reference to `boost::system::generic_category()'
/usr/include/boost/system/error_code.hpp:215: undefined reference to `boost::system::generic_category()'
/usr/include/boost/system/error_code.hpp:216: undefined reference to `boost::system::system_category()'
./src/DatabaseHandler.o:DatabaseHandler.cpp:(.debug_info+0xe9de): undefined reference to `pqxx::internal::freemem_result_data(pqxx::internal::result_data const*)'
./src/DatabaseHandler.o:DatabaseHandler.cpp:(.debug_info+0x10da1): undefined reference to `pqxx::internal::freemem_result_data(pqxx::internal::result_data const*)'
./src/DatabaseHandler.o: In function `connect_direct':
/usr/local/include/pqxx/connection.hxx:87: undefined reference to `pqxx::connectionpolicy::connectionpolicy(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/local/include/pqxx/connection.hxx:87: undefined reference to `vtable for pqxx::connect_direct'
./src/DatabaseHandler.o: In function `~connect_direct':
/usr/local/include/pqxx/connection.hxx:85: undefined reference to `vtable for pqxx::connect_direct'
/usr/local/include/pqxx/connection.hxx:85: undefined reference to `pqxx::connectionpolicy::~connectionpolicy()'
./src/DatabaseHandler.o: In function `basic_connection':
/usr/local/include/pqxx/basic_connection.hxx:61: undefined reference to `pqxx::connection_base::connection_base(pqxx::connectionpolicy&)'
makefile:45: recipe for target `test.exe' failed
/usr/local/include/pqxx/basic_connection.hxx:62: undefined reference to `pqxx::connection_base::init()'
./src/DatabaseHandler.o: In function `~basic_connection':
/usr/local/include/pqxx/basic_connection.hxx:78: undefined reference to `pqxx::connection_base::close()'
./src/DatabaseHandler.o: In function `basic_connection':
/usr/local/include/pqxx/basic_connection.hxx:70: undefined reference to `pqxx::connection_base::connection_base(pqxx::connectionpolicy&)'
/usr/local/include/pqxx/basic_connection.hxx:71: undefined reference to `pqxx::connection_base::init()'
./src/global.o: In function `__static_initialization_and_destruction_0':
/usr/include/boost/system/error_code.hpp:214: undefined reference to `boost::system::generic_category()'
/usr/include/boost/system/error_code.hpp:215: undefined reference to `boost::system::generic_category()'
/usr/include/boost/system/error_code.hpp:216: undefined reference to `boost::system::system_category()'
collect2: ld returned 1 exit status
make: *** [test.exe] Error 1

Build Finished ****


Weitere Daten:
OS: Windows 7 x64
IDE: Eclipse CDT (Cywin GCC)

Grüße
-eintyp-

Content-ID: 183318

Url: https://administrator.de/contentid/183318

Ausgedruckt am: 26.11.2024 um 07:11 Uhr

EinTyp
EinTyp 11.04.2012 um 00:23:13 Uhr
Goto Top
Ich habe bemerkt, dass dieser Fehler auftritt wenn ich
#include <boost/filesystem.hpp>
include. Ich hoffe mir kann jemand weiterhelfen.