Raj Powar Raj Powar - 9 months ago 55
C++ Question

Compilation Error Undefined symbols for architecture x86_64:

I have a program that i am trying to compile from my project directory and haven't been able to wrap my head around the following error

My compilation command

g++ grades.cpp -o grades

I see the following error

Undefined symbols for architecture x86_64:
"tbb::task_scheduler_init::initialize(int, unsigned long)", referenced from:
tbb::task_scheduler_init::task_scheduler_init(int, unsigned long) in grades-9c8d1a.o
"tbb::task_scheduler_init::terminate()", referenced from:
tbb::task_scheduler_init::~task_scheduler_init() in grades-9c8d1a.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I am not sure how to debug this error.

Answer Source

You need to link against the tbb library you are tying to use,

g++ grades.cpp -o grades -ltbb