Reputation: 1698
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 <EASTL/vector.h>
#include <EASTL/fixed_vector.h>
int main()
{
eastl::fixed_vector<int,10,true> 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 .
Upvotes: 2
Views: 3998
Reputation: 567
But recommended at original site this >> https://github.com/electronicarts/EASTL/blob/master/doc/CMake/EASTL_Project_Integration.md#setting-up-your-code
void* operator new[](size_t size, const char* name, int flags, unsigned debugFlags, const char* file, int line)
{
return new uint8_t[size];
}
Upvotes: 4