undefined reference to ...
Bonjour a tous.
Etant debutant en C++, j'ai terminer mon premier projet et je suis maintenant aux tests unitaires.
Des la 2eme classe de tests, je rencontre ce probleme :
Citation:
/tmp/ccHno3kM.o: In function `SensorNamespace::Sensor::getNature()':
SensorTest_Unit.cpp: (.text+0x8ab): undefined reference to `soci::postgresql'
SensorTest_Unit.cpp: (.text+0x8b3): undefined reference to `soci::session::session(soci::backend_factory const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
SensorTest_Unit.cpp: (.text+0x947): undefined reference to `soci::details::prepare_temp_type::~prepare_temp_type()'
SensorTest_Unit.cpp: (.text+0x95e): undefined reference to `soci::details::prepare_temp_type::~prepare_temp_type()'
SensorTest_Unit.cpp: (.text+0xb11): undefined reference to `soci::session::~session()'
SensorTest_Unit.cpp: (.text+0xb28): undefined reference to `soci::session::~session()'
en gros, a ce que je comprends, il manque des includes dans mes fichiers, mais les includes sont la, bien la !
pour compiler j'utilise cette commande :
Citation:
g++ -o sensor -lboost_unit_test_framework SensorTest_Unit.cpp -I/usr/local/include/soci/ -I/usr/local/pgsql/include/
Ma premiere classe de test fonctionne correctement car il n'y a pas de connexion avec postgresql...
et voici la classe en question qui bug :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
| #define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MODULE Sensor
#include <boost/test/unit_test.hpp>
//#include "../GetSetValues/Sensor.cpp"
#include "../GetSetValues/Sensor.hpp"
#include <soci/session.h>
#include <soci/soci.h>
#include <soci/soci-backend.h>
#include <soci/postgresql/soci-postgresql.h>
#include <soci/postgresql/common.h>
#include <cstdlib>
using namespace soci;
using namespace SensorNamespace;
BOOST_AUTO_TEST_SUITE(unit)
BOOST_AUTO_TEST_SUITE(sensor)
// constructeur + get
BOOST_AUTO_TEST_CASE(sensor_construct) {
int sID = 10;
int supID = 11;
std::string nat = "temperature";
BOOST_CHECK_EQUAL(sID,10);
SensorNamespace::Sensor s(sID,supID,nat);
BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_SUITE_END() |
Merci d'avance de vos réponses :)