I'm on MacOS and with g++-11. Folly successfully builds and when I try to run a piece of code from the test file executors/test/ExecutorWithPriorityTest.cpp, the compiler says
/Users/tannyxie/Documents/Project Preparation/github/folly_include/installed/folly/include/folly/FBString.h:2753:8: error: 'fmt' has not been declared
2753 | struct fmt::formatter<folly::fbstring> : private formatter<fmt::string_view> {
| ^~~
/Users/tannyxie/Documents/Project Preparation/github/folly_include/installed/folly/include/folly/FBString.h:2753:22: error: expected unqualified-id before '<' token
2753 | struct fmt::formatter<folly::fbstring> : private formatter<fmt::string_view> {
| ^
This is the code I run.
#include <folly/executors/ExecutorWithPriority.h>
#include <folly/executors/CPUThreadPoolExecutor.h>
#include <folly/futures/Future.h>
#include <folly/portability/GTest.h>
using namespace folly;
int main() {
bool tookLopri = false;
auto completed = 0;
auto hipri = [&] {
EXPECT_FALSE(tookLopri);
completed++;
};
auto lopri = [&] {
tookLopri = true;
completed++;
};
auto pool = std::make_shared<CPUThreadPoolExecutor>(
0 /*numThreads*/, 2 /*numPriorities*/);
{
auto loPriExecutor = ExecutorWithPriority::create(
getKeepAliveToken(pool.get()), Executor::LO_PRI);
auto hiPriExecutor = ExecutorWithPriority::create(
getKeepAliveToken(pool.get()), Executor::HI_PRI);
for (int i = 0; i < 50; i++) {
loPriExecutor->add(lopri);
}
for (int i = 0; i < 50; i++) {
hiPriExecutor->add(hipri);
}
pool->setNumThreads(1);
}
pool->join();
}
I compiled it with command g++-11 folly.cpp.
Am I missing any header file? Or should I add some command line flag?