From: <syn...@gm...> - 2006-06-29 13:37:43
|
Nitin Soman wrote: > Hi, > > I am new for using small object allocator.I have read about its four layers > in the Modern C++ Design book. > Can any body give me a small example to demonstrate small objects in Visual > C++. > Here is what I wrote but I am getting error LNK2001(some linkage > error).Kindly reply soon. > > > #include <stdlib.h> > #include <iostream.h> > #include "SmallObj.h" > #include <cstddef> > #include <cstdlib> > #include <stdexcept> > #include "Threads.h" > > using namespace Loki; > > class user:public > Loki::SmallObject<Loki::SingleThreaded,DEFAULT_CHUNK_SIZE,MAX_SMALL_OBJECT_S > IZE> > { > public: > int m; > > user() > { > m=10; > } > }; > > > > int main() > { > > user obj = new user; > > cout << obj.m; > > return 0; > > } > > Regards, > > Nitin Soman > Have you linked against loki.lib or libloki.a? You could also add the /loki/src/ files to your project. Peter |