| | |
Errors compiling Loki on Mandriva One Spring 2008
Please support our C++ advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
•
•
Join Date: Sep 2008
Posts: 31
Reputation:
Solved Threads: 0
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:
Compiler output:
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:
C++ Syntax (Toggle Plain Text)
#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:
C++ Syntax (Toggle Plain Text)
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
Last edited by rmlopes; Oct 28th, 2008 at 6:09 am.
•
•
Join Date: Jan 2008
Posts: 119
Reputation:
Solved Threads: 10
hmm, the thread name is kind of missguiding
this should better be "error linking to loki"
as you can see all your .o files compile fine, but the linking is the problem
did you build the Loki library?
I know Loki is mostly a template library that need not be compiled, but I think it has some parts that maybe do need to be compiled (just like boost is with it's concurrency and networking classes). Your example looks like this could be the case.
Look at the methods that you have undefined refrence to, compile the source files that they appear in, and then when you build your main.exe link to all the required object files
this should better be "error linking to loki"
as you can see all your .o files compile fine, but the linking is the problem
did you build the Loki library?
I know Loki is mostly a template library that need not be compiled, but I think it has some parts that maybe do need to be compiled (just like boost is with it's concurrency and networking classes). Your example looks like this could be the case.
Look at the methods that you have undefined refrence to, compile the source files that they appear in, and then when you build your main.exe link to all the required object files
![]() |
Other Threads in the C++ Forum
- Previous Thread: Simple Data Type
- Next Thread: DWM 2
Views: 663 | Replies: 2
| Thread Tools | Search this Thread |
Tag cloud for C++
6 api application array arrays assignment beginner binary bitmap c++ c/c++ calculator char class classes code coding compile compiler console conversion convert count data database delete developer display dll email encryption error file forms fstream function functions game generator getline givemetehcodez graph homeworkhelper iamthwee ifstream image input int java lazy lib loop looping loops map math matrix memory multidimensional multiple newbie news node number output parameter pointer problem program programming project proxy python random read recursion recursive reference return sort sorting string strings struct template templates text tree url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets





