- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am trying to extend the task class and override the "spawn_and_wait_for_all" class function. Like this.
MyTask.h:
namespace tbb {
class my_task: public task {
public:
void spawn_and_wait_for_all ( task& child ) { }
}
}
If the define the "spawn_and_wait_for_all" in the class itself (like above) I am able to call that function. But when I put the function definition in a separate cpp file I get an "undefined reference error". Like this
MyTask.h:
namespace tbb {
class my_task: public task {
public:
void spawn_and_wait_for_all ( task& child );
}
}
MyTask.cpp:
namespace tbb {
void my_task::spawn_and_wait_for_all ( task& child ) { }
}
ERROR: undefined reference to `tbb::my_task::spawn_and_wait_for_all (tbb::task&)'
Am I doing anything fundamentally wrong here? I have even tried not extending the task class but add a new "new_spawn_and_wait_for_all" function to the task class itself and defining it in task.cpp. It still gives me an undefined reference error.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Don't change TBB itself: just define the class in your own library and your own namespace.
Don't try to override a non-virtual member function.
I'm guessing that your definition was not appropriately scoped, so the compiler made it into a new unrelated function.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page