diff --git a/examples/SolverComparer.cpp b/examples/SolverComparer.cpp index 6bdb8cf26..49159924d 100644 --- a/examples/SolverComparer.cpp +++ b/examples/SolverComparer.cpp @@ -34,9 +34,11 @@ #include #include +#ifdef GTSAM_USE_TBB #include #undef max // TBB seems to include windows.h and we don't want these macros #undef min +#endif using namespace std; using namespace gtsam; @@ -185,12 +187,19 @@ int main(int argc, char *argv[]) { } } +#ifdef GTSAM_USE_TBB std::auto_ptr init; if(nThreads > 0) { cout << "Using " << nThreads << " threads" << endl; init.reset(new tbb::task_scheduler_init(nThreads)); } else cout << "Using threads for all processors" << endl; +#else + if(nThreads > 0) { + std::cout << "GTSAM is not compiled with TBB, so threading is disabled and the --threads option cannot be used." << endl; + exit(1); + } +#endif // Run mode if(incremental)