- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, I'm a novice to Linux and TBB. I am asking help for how to build TBB in Ubutu.
I have already downloaded the source file: tbb20_20070927oss_src. And then I enter the directory and 'make': ~/tbb20_20070927oss_src/$ make
After running a bunch of stuff, I still can't compile TBB sample code.
My sample code:
#include "tbb/task_scheduler_init.h"
using namespace tbb;
int main() {
task_scheduler_init init;
return 0;
}
When I's using g++ compile, it shows:
/tmp/cccwYHds.o: In function `tbb::task_scheduler_init::task_scheduler_init(int)':
tbbtext.cpp:(.text._ZN3tbb19task_scheduler_initC1Ei[tbb::task_scheduler_init::task_scheduler_init(int)]+0x28): undefined reference to `tbb::task_scheduler_init::initialize(int)'
/tmp/cccwYHds.o: In function `tbb::task_scheduler_init::~task_scheduler_init()':
tbbtext.cpp:(.text._ZN3tbb19task_scheduler_initD1Ev[tbb::task_scheduler_init::~task_scheduler_init()]+0x16): undefined reference to `tbb::task_scheduler_init::terminate()'
collect2: ld returned 1 exit status
I guess I failed to install TBB on my machine. Could anyone give some help?
I have already downloaded the source file: tbb20_20070927oss_src. And then I enter the directory and 'make': ~/tbb20_20070927oss_src/$ make
After running a bunch of stuff, I still can't compile TBB sample code.
My sample code:
#include "tbb/task_scheduler_init.h"
using namespace tbb;
int main() {
task_scheduler_init init;
return 0;
}
When I's using g++ compile, it shows:
/tmp/cccwYHds.o: In function `tbb::task_scheduler_init::task_scheduler_init(int)':
tbbtext.cpp:(.text._ZN3tbb19task_scheduler_initC1Ei[tbb::task_scheduler_init::task_scheduler_init(int)]+0x28): undefined reference to `tbb::task_scheduler_init::initialize(int)'
/tmp/cccwYHds.o: In function `tbb::task_scheduler_init::~task_scheduler_init()':
tbbtext.cpp:(.text._ZN3tbb19task_scheduler_initD1Ev[tbb::task_scheduler_init::~task_scheduler_init()]+0x16): undefined reference to `tbb::task_scheduler_init::terminate()'
collect2: ld returned 1 exit status
I guess I failed to install TBB on my machine. Could anyone give some help?
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I copy share library in the directory ~/lib/libtbb.so. Then my command line:
g++ tbb.cpp -o tbb -L/~/lib/ -ltbb
And it works!!!
I also install the tbb package ( a bunch of .deb files ). I could find the file tbb(there are a bunch of *.h files) in the directory as /usr/include/tbb which is the same as my boost libraries /usr/include/boost.
But now the question is:
When I am using boost libraries,
#include
int main() {
boost::dynamic_bitset<> bitsetting;
return 0;
}
the command line as: $ g++ -o test test.cpp. There is no error.
However when I am using TBB libraries,
#include
int main() {
tbb::task_scheduler_init init;
return 0;
}
It will pop out those errors when I am using $ g++ -o test test.cpp. I don't know why?
The only difference is that I install the boost libraries through Synaptic Package Manager, but as to the TBB libraries, I am using dpkg --install ***tbb**.deb to install TBB libraries. Should I modify some enviromental settings?
g++ tbb.cpp -o tbb -L/~/lib/ -ltbb
And it works!!!
I also install the tbb package ( a bunch of .deb files ). I could find the file tbb(there are a bunch of *.h files) in the directory as /usr/include/tbb which is the same as my boost libraries /usr/include/boost.
But now the question is:
When I am using boost libraries,
#include
int main() {
boost::dynamic_bitset<> bitsetting;
return 0;
}
the command line as: $ g++ -o test test.cpp. There is no error.
However when I am using TBB libraries,
#include
int main() {
tbb::task_scheduler_init init;
return 0;
}
It will pop out those errors when I am using $ g++ -o test test.cpp. I don't know why?
The only difference is that I install the boost libraries through Synaptic Package Manager, but as to the TBB libraries, I am using dpkg --install ***tbb**.deb to install TBB libraries. Should I modify some enviromental settings?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Looks like libtbb.so is out of environement.Does$LIB variable point to folder with libtbb.so file?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
leileicats:But now the question is:
When I am using boost libraries,
#include
int main() {
boost::dynamic_bitset<> bitsetting;
return 0;
}
the command line as: $ g++ -o test test.cpp. There is no error.
However when I am using TBB libraries,
#include
int main() {
tbb::task_scheduler_init init;
return 0;
}
It will pop out those errors when I am using $ g++ -o test test.cpp. I don't know why?
I am not an expert in Boost so may be incorrect, but I think the difference is that for boost/dynamic_bitset all its implementation is in the header file so there is no need for any library to link with. TBB classes are mostly different, they call other classes or some functions instantiated in the TBB .so files. Thus you need to provide -ltbb to the compiler (or more precisely, thelinker); like as you would dowith, say, the POSIX thread library which use has to be explicitly specified with -lpthread.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you very much for your information. I think I have figured out what is the problem.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page