| Compiling with Boost Threads [message #823883] |
Sun, 18 March 2012 21:57 |
Diontje Dee Messages: 1 Registered: March 2012 |
Junior Member |
|
|
I am a n00b.
I am attempting to use the Boost Threads library and I am running into some errors.
Would one of you wizards please assist me with as much detail as you have time for. My project `Includes` folder shows the boost files (/usr/include/boost). In my project properties (paths and symbols), I have included this path in `Library Paths` and `Includes` tabs for both GNU C and CNU C++. Here is my code. It is only a test to see if I can compile. Spawning one thread is my goal.
#include <iostream>
#include <boost/thread.hpp>
using namespace std;
void task1(void)
{
cout << "There" << endl;
}
int main()
{
boost::thread mythread(task1);
cout << "Hi" << endl;
return 0;
}
My Console Ouptut:
**** Build of configuration Debug for project MyThread1 ****
make all
Building target: MyThread1
Invoking: GCC C++ Linker
g++ -L/usr/include/boost -o "MyThread1" ./mythread1.o -lboost_filesystem
./mythread1.o: In function `main':
/home/diontje/Documents/workspace/MyThread1/Debug/../mythread1.cpp:13: undefined reference to `boost::thread::~thread()'
/home/diontje/Documents/workspace/MyThread1/Debug/../mythread1.cpp:13: undefined reference to `boost::thread::~thread()'
./mythread1.o: In function `thread_data_base':
/usr/include/boost/thread/pthread/thread_data.hpp:65: undefined reference to `vtable for boost::detail::thread_data_base'
./mythread1.o: In function `thread<void (*)()>':
/usr/include/boost/thread/detail/thread.hpp:191: undefined reference to `boost::thread::start_thread()'
./mythread1.o: In function `~thread_data':
/usr/include/boost/thread/detail/thread.hpp:40: undefined reference to `boost::detail::thread_data_base::~thread_data_base()'
./mythread1.o:(.rodata._ZTIN5boost6detail11thread_dataIPFvvEEE[typeinfo for boost::detail::thread_data<void (*)()>]+0x10): undefined reference to `typeinfo for boost::detail::thread_data_base'
collect2: ld returned 1 exit status
make: *** [MyThread1] Error 1
**** Build Finished ****
|
|
|
Powered by
FUDForum. Page generated in 0.04731 seconds