Can't solve a reference problem, please help
Added by Gustavo Sooeiro almost 13 years ago
Its been a while that I am trying to figure it out what I am doing wrong, but I can't find!!
I am getting a cascade of undefined reference errors:
14:23:23: Running steps for project hangman...
14:23:23: Configuration unchanged, skipping qmake step.
14:23:23: Starting: "/usr/bin/make" -w
make: Entering directory `/home/sidarta/workspace/hangman-build'
g -Wl,-O1 -o hangman_exe Dictionary.o hangman.o HangmanGame.o HangmanWidget.o HighScoresWidget.o ImagesWidget.o LettersWidget.o Session.o User.o WordWidget.o CidadesWidget.o -L/usr/lib/i386-linux-gnu -L/usr/lib -lwtdbo -lwtdbopostgres -lwt -lwthttp -I/usr/local/include -lboost_regex -lboost_signals -lboost_system -lboost_thread -lboost_filesystem -lboost_date_time -lcrypt -lpthread
Session.o: In function `Session::showCidades(int)':
make: Leaving directory `/home/sidarta/workspace/hangman-build'
Session.C:(.text+0x8c6): undefined reference to `Wt::Dbo::Query<Wt::Dbo::ptr, Wt::Dbo::DynamicBinding> Wt::Dbo::Session::find<Cidade, Wt::Dbo::DynamicBinding>(std::basic_string<char, std::char_traits, std::allocator > const&)'
Session.C:(.text+0x8d9): undefined reference to `Wt::Dbo::Query<Wt::Dbo::ptr, Wt::Dbo::DynamicBinding>::operator Wt::Dbo::collection<Wt::Dbo::ptr >() const'
Session.C:(.text+0x8e4): undefined reference to `Wt::Dbo::Query<Wt::Dbo::ptr, Wt::Dbo::DynamicBinding>::~Query()'
Session.C:(.text+0x8f8): undefined reference to `Wt::Dbo::collection<Wt::Dbo::ptr >::size() const'
Session.C:(.text+0x98d): undefined reference to `Wt::Dbo::collection<Wt::Dbo::ptr >::begin()'
Session.C:(.text+0x9a0): undefined reference to `Wt::Dbo::collection<Wt::Dbo::ptr >::const_iterator::const_iterator(Wt::Dbo::collection<Wt::Dbo::ptr >::iterator const&)'
Session.C:(.text+0x9a8): undefined reference to `Wt::Dbo::collection<Wt::Dbo::ptr >::iterator::~iterator()'
Session.C:(.text+0x9d7): undefined reference to `Wt::Dbo::ptr::~ptr()'
Session.C:(.text+0x9e3): undefined reference to `Wt::Dbo::collection<Wt::Dbo::ptr >::const_iterator::operator()'
Session.C:(.text+0x9f3): undefined reference to `Wt::Dbo::collection<Wt::Dbo::ptr >::end()'
Session.C:(.text+0xa06): undefined reference to `Wt::Dbo::collection<Wt::Dbo::ptr >::const_iterator::const_iterator(Wt::Dbo::collection<Wt::Dbo::ptr >::iterator const&)'
Session.C:(.text+0xa1a): undefined reference to `Wt::Dbo::collection<Wt::Dbo::ptr >::const_iterator::operator!=(Wt::Dbo::collection<Wt::Dbo::ptr >::const_iterator const&) const'
Session.C:(.text+0xa28): undefined reference to `Wt::Dbo::collection<Wt::Dbo::ptr >::iterator::~iterator()'
Session.C:(.text+0xa30): undefined reference to `Wt::Dbo::collection<Wt::Dbo::ptr >::iterator::~iterator()'
Session.C:(.text+0xa4c): undefined reference to `Wt::Dbo::collection<Wt::Dbo::ptr >::const_iterator::operator*()'
Session.C:(.text+0xa57): undefined reference to `Wt::Dbo::ptr::operator->() const'
Session.C:(.text+0xad0): undefined reference to `Wt::Dbo::collection<Wt::Dbo::ptr >::iterator::~iterator()'
Session.C:(.text+0xae8): undefined reference to `Wt::Dbo::collection<Wt::Dbo::ptr >::~collection()'
Session.C:(.text+0xb2b): undefined reference to `Wt::Dbo::ptr::~ptr()'
Session.C:(.text+0xb37): undefined reference to `Wt::Dbo::collection<Wt::Dbo::ptr >::iterator::~iterator()'
Session.C:(.text+0xb43): undefined reference to `Wt::Dbo::collection<Wt::Dbo::ptr >::~collection()'
Session.C:(.text+0xb83): undefined reference to `Wt::Dbo::collection<Wt::Dbo::ptr >::~collection()'
Session.C:(.text+0xb91): undefined reference to `Wt::Dbo::Query<Wt::Dbo::ptr, Wt::Dbo::DynamicBinding>::~Query()'
Session.C:(.text+0xba1): undefined reference to `Wt::Dbo::collection<Wt::Dbo::ptr >::iterator::~iterator()'
Session.C:(.text+0xba9): undefined reference to `Wt::Dbo::collection<Wt::Dbo::ptr >::iterator::~iterator()'
Session.C:(.text+0xbc2): undefined reference to `Wt::Dbo::collection<Wt::Dbo::ptr >::iterator::~iterator()'
Session.o: In function `Session::Session()':
Session.C:(.text+0xf5b): undefined reference to `void Wt::Dbo::Session::mapClass(char const*)'
collect2: ld returned 1 exit status
make: * [hangman_exe] Error 1
14:23:24: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project hangman (target: Desktop)
When executing step 'Make'
Anyone can please give me a clue!!??
Thanks a lot!
Replies (2)
RE: Can't solve a reference problem, please help - Added by Wim Dumon almost 13 years ago
Hello Gustavo,
Your link command line looks fine, since you link to dbo, a dbo backend, wt and a wt backend. It strikes me that all missing symbols are template symbols, that have to do with one particular class that you want to serialize using Dbo (Cidade). My guess it that you used the DBO_EXTERN_TEMPLATES() macro for the Cidade class, without writing DBO_EXTERN_TEMPLATES(Cidade) in one of your cpp files.
My recommendation: do not use the DBO_EXTERN_TEMPLATES macro; simply remove the line. It is an optimization for expert users (the macro is not documented because you need to understand its implications and they are complex) which can reduce compilation times.
BR,
Wim.
RE: Can't solve a reference problem, please help - Added by Gustavo Sooeiro almost 13 years ago
Hey Wim,
Thanks a lot for your answer. I resoved the problem. I was extending unnecessarily the class Cidade from another dbo class. I had copied from the User class!
I would like to study more to understand the complexity that you referred to, can you point me the direction of what to read?
Thanks.
BR,
Gustavo.