2016-03-07 6 views
0
#include <folly/futures/Future.h> 
#include<iostream> 
using namespace folly; 
using namespace std; 

void foo(int x) 
{ 
    // do something with x 
    cout << "foo(" << x << ")" << endl; 
} 
// ... 
int main() 
{ 
    cout << "making Promise" << endl; 
    Promise<int> p; 
    Future<int> f = p.getFuture(); 
    return 0; 
} 

LD_LIBRARY_PATH установлен в /usr/local/libКомпиляция проблема при использовании Folly Futures

Когда я компилирую, используя

g++ -std=c++11 sample.cpp -pthread -llzma -lz -lsnappy -llz4 -liberty \ 
    -ljemalloc -levent -ldouble-conversion -lssl -lgflags -lglog -lboost_system 

Я получаю сообщение об ошибке:

/tmp/ccuDCM19.o: In function `main': 
sample.cpp:(.text+0x1a7): undefined reference to `folly::Future<int>::~Future()' 
/tmp/ccuDCM19.o: In function `folly::RequestContext::setContext(std::shared_ptr<folly::RequestContext>)': 
sample.cpp:(.text._ZN5folly14RequestContext10setContextESt10shared_ptrIS0_E[_ZN5folly14RequestContext10setContextESt10shared_ptrIS0_E]+0x11): undefined reference to `folly::RequestContext::getStaticContext()' 
/tmp/ccuDCM19.o: In function `folly::Promise<int>::getFuture()': 
sample.cpp:(.text._ZN5folly7PromiseIiE9getFutureEv[_ZN5folly7PromiseIiE9getFutureEv]+0x36): undefined reference to `folly::Future<int>::Future(folly::detail::Core<int>*)' 
collect2: error: ld returned 1 exit status 

ответ