我使用下面给出的以下链接构建了 facebook 愚蠢库
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;
}
编写此代码后,只需编译它..当我编译时,得到以下问题..
syscon@syscon-OptiPlex-3020:~/Documents/work/folly/folly-master$ g++ -o stl stl.cpp -std=c++11 -lboost_system
/tmp/cc2WeDlr.o: 在函数folly::usingJEMalloc()':stl.cpp:(.text._ZN5folly13usingJEMallocEv[_ZN5folly13usingJEMallocEv]+0x2d): undefined reference to
folly::usingJEMallocSlow()'collect2: 错误: ld 返回 1 退出状态
为了解决这个问题,我需要包含哪个库?