Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Compiling with Boost Threads(How to compile Boost Threads in Eclipse)
Compiling with Boost Threads [message #823883] Mon, 19 March 2012 01:57
Diontje Dee is currently offline Diontje DeeFriend
Messages: 1
Registered: March 2012
Junior Member
I am a n00b. Sad

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 ****

Previous Topic:Folding
Next Topic:importing a project in eclipse
Goto Forum:
  


Current Time: Wed Apr 24 23:17:54 GMT 2024

Powered by FUDForum. Page generated in 0.07794 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top