0

I have built the facebook folly libraries by using the following link given below

https://github.com/facebook/folly

#include <iostream>
#include <stdlib.h>
#include <algorithm>
#include <typeinfo>
#include <vector>
#include "folly/FBVector.h"
int main()
{
        folly::fbvector<int> vec;
        folly::fbvector<int>::iterator vIter;

        int i = 0;

        for(i = 0;i < 10;i++)
        {
                vec.push_back(i);
        }

        for(i = 0 ; i <=vec.size();i++)
        {
                cout << vec[i] << endl;
        }

        vec.erase(vec.begin()+ 5);

        vec.insert(vec.begin()+5,25);
        vec.insert(vec.begin()+5,5);
        vec.insert(vec.begin()+5,5);

        sort(vec.begin(),vec.end());

        cout << "Using Iteration Concept " << endl;
        for(vIter = vec.begin() ; vIter != vec.end();vIter++)
        {
                cout << *vIter << endl;
        }

        return 0;
}

After writting this code ,just compiled it..when i was compiling,getting the following issue..

syscon@syscon-OptiPlex-3020:~/Documents/work/folly/folly-master$ g++ -o stl stl.cpp -std=c++11 -lboost_system

/tmp/cc2WeDlr.o: In function folly::usingJEMalloc()':stl.cpp:(.text._ZN5folly13usingJEMallocEv[_ZN5folly13usingJEMallocEv]+0x2d): undefined reference tofolly::usingJEMallocSlow()' collect2: error: ld returned 1 exit status

which library i need to include inorder to solve this issue?

valiano
  • 16,433
  • 7
  • 64
  • 79
  • possible duplicate of [What is an undefined reference/unresolved external symbol error and how do I fix it?](http://stackoverflow.com/questions/12573816/what-is-an-undefined-reference-unresolved-external-symbol-error-and-how-do-i-fix) – eerorika Mar 23 '15 at 12:37

1 Answers1

2

That particular symbol comes from: https://github.com/facebook/folly/blob/master/folly/Malloc.cpp so it's part of the compiled folly library (ie, it's not just a header-only dependency). You need to link against it.

Depending on how you compiled/installed folly will determine how to fix the problem, e.g. adding -lfolly to the compilation line.

Louis Brandy
  • 19,028
  • 3
  • 38
  • 29