Hello,
I am writing an application that uses the Loki library and I get undefined references inside loki if I use the DefaultSPStorage with std::vector<int> (it happens the same with int or using HeapStorage instead). I am developing on Mandriva 2008. Can someone please help me?
Thank you in advance
Rui
main.cpp:
#include "include/loki/SmartPtr.h"
#include "Solution.h"
#include <iostream>
using namespace brickheuristics;
int main(void){
typedef Loki::DefaultSPStorage< std::vector<int> > SolStorage;
typedef Solution<
SolStorage,
DummyEval,
DummyFeasibility,
DummyChanging,
DummyPrinting
> MySolution;
MySolution s = MySolution();
cout << s.toString();
return 0;
}
Compiler output:
g++ -O2 -g -Wall -fmessage-length=0 -c -o main.o main.cpp
g++ -o main.exe main.o
main.o: In function `Loki::SmallObjectBase<Loki::SingleThreaded, 4096u, 256u, 4u, Loki::LongevityLifetime::DieAsSmallObjectParent, Loki::Mutex>::operator new(unsigned int)':
/home/rmlopes/brickheuristics/src/include/loki/SmallObj.h:467: undefined reference to `Loki::SmallObjAllocator::Allocate(unsigned int, bool)'
main.o: In function `Loki::SmallObjectBase<Loki::SingleThreaded, 4096u, 256u, 4u, Loki::LongevityLifetime::DieAsSmallObjectParent, Loki::Mutex>::operator delete(void*, unsigned int)':
/home/rmlopes/brickheuristics/src/include/loki/SmallObj.h:489: undefined reference to `Loki::SmallObjAllocator::Deallocate(void*, unsigned int)'
/home/rmlopes/brickheuristics/src/include/loki/SmallObj.h:489: undefined reference to `Loki::SmallObjAllocator::Deallocate(void*, unsigned int)'
/home/rmlopes/brickheuristics/src/include/loki/SmallObj.h:489: undefined reference to `Loki::SmallObjAllocator::Deallocate(void*, unsigned int)'
/home/rmlopes/brickheuristics/src/include/loki/SmallObj.h:489: undefined reference to `Loki::SmallObjAllocator::Deallocate(void*, unsigned int)'
main.o: In function `AllocatorSingleton':
/home/rmlopes/brickheuristics/src/include/loki/SmallObj.h:245: undefined reference to `Loki::SmallObjAllocator::SmallObjAllocator(unsigned int, unsigned int, unsigned int)'
main.o: In function `~AllocatorSingleton':
/home/rmlopes/brickheuristics/src/include/loki/SmallObj.h:249: undefined reference to `Loki::SmallObjAllocator::~SmallObjAllocator()'
main.o: In function `void Loki::SetLongevity<Loki::AllocatorSingleton<Loki::SingleThreaded, 4096u, 256u, 4u, Loki::LongevityLifetime::DieAsSmallObjectParent, Loki::Mutex>, Loki::Private::Adapter<Loki::AllocatorSingleton<Loki::SingleThreaded, 4096u, 256u, 4u, Loki::LongevityLifetime::DieAsSmallObjectParent, Loki::Mutex> > >(Loki::AllocatorSingleton<Loki::SingleThreaded, 4096u, 256u, 4u, Loki::LongevityLifetime::DieAsSmallObjectParent, Loki::Mutex>*, unsigned int, Loki::Private::Adapter<Loki::AllocatorSingleton<Loki::SingleThreaded, 4096u, 256u, 4u, Loki::LongevityLifetime::DieAsSmallObjectParent, Loki::Mutex> >)':
/home/rmlopes/brickheuristics/src/include/loki/Singleton.h:154: undefined reference to `Loki::Private::pTrackerArray'
/home/rmlopes/brickheuristics/src/include/loki/Singleton.h:166: undefined reference to `Loki::Private::pTrackerArray'
/home/rmlopes/brickheuristics/src/include/loki/Singleton.h:169: undefined reference to `Loki::Private::pTrackerArray'
/home/rmlopes/brickheuristics/src/include/loki/Singleton.h:175: undefined reference to `Loki::Private::AtExitFn()'
/home/rmlopes/brickheuristics/src/include/loki/Singleton.h:155: undefined reference to `Loki::Private::pTrackerArray'
main.o: In function `AllocatorSingleton':
/home/rmlopes/brickheuristics/src/include/loki/SmallObj.h:245: undefined reference to `Loki::SmallObjAllocator::SmallObjAllocator(unsigned int, unsigned int, unsigned int)'
main.o: In function `Loki::SmallObjectBase<Loki::SingleThreaded, 4096u, 256u, 4u, Loki::LongevityLifetime::DieAsSmallObjectParent, Loki::Mutex>::operator delete(void*, unsigned int)':
/home/rmlopes/brickheuristics/src/include/loki/SmallObj.h:489: undefined reference to `Loki::SmallObjAllocator::Deallocate(void*, unsigned int)'
/home/rmlopes/brickheuristics/src/include/loki/SmallObj.h:489: undefined reference to `Loki::SmallObjAllocator::Deallocate(void*, unsigned int)'
collect2: ld returned 1 exit status
make: *** [main.exe] Error 1