Sunday, February 11, 2018

c++ - how to build eastl library

Recently I am trying to build eastl library in linux 3.10 x86_64 but failed .



https://github.com/electronicarts/EASTL



do has "Compiling sources" webpage here :




https://github.com/electronicarts/EASTL/blob/master/CONTRIBUTING.md



follow the instructions and get libEASTL.a , ar -t libEASTL.a get :



allocator_eastl.cpp.o
assert.cpp.o
fixed_pool.cpp.o
hashtable.cpp.o
intrusive_list.cpp.o

numeric_limits.cpp.o
red_black_tree.cpp.o
string.cpp.o
thread_support.cpp.o


Then a tiny test source :



#include 
#include

int main()
{
eastl::fixed_vector v ;
int iarr[10] ;
for(int idx=0;idx<10;idx++){
iarr[idx] = idx + 1 ;
v.push_back( iarr[idx] ) ;
}
}



compiled it by :



g++ --std=c++11 -O2 test1.cpp -I/home/mars/tools/EASTL-master/include -I/home/mars/tools/EASTL-master/test/packages/EABase/include/Common /home/mars/tools/EASTL-master/thelib/libEASTL.a -o test1.exe



will get the link error :



undefined reference to `operator new[](unsigned long, char const*, int, unsigned int, char const*, int)'



The eastl library should have a easy way to build and include header files ,

I just miss it , any advice are great appreciated .



Edit :



After I add this new function , link error is gone !!!



void* operator new[](size_t size, const char* pName, 
int flags, unsigned debugFlags, const char* file, int line)
{
;

}


so the only question left is : I need to code this new function right !!!!
to do that , any document can give me a clue ?!



Edit2 :



according to this website information :




https://wuyingren.github.io/howto/2016/02/11/Using-EASTL-in-your-projects/



void* operator new[](size_t size, const char* pName, int flags, unsigned     debugFlags, const char* file, int line) 
{
return malloc(size);
}

void* operator new[](size_t size, size_t alignment, size_t alignmentOffset, const char* pName, int flags, unsigned debugFlags, const char* file, int line)
{
return malloc(size);

}


then the work is done .

No comments:

Post a Comment

plot explanation - Why did Peaches&#39; mom hang on the tree? - Movies &amp; TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...