Problem with basic program using Boost Threads in c++
- by Eternal Learner
I have a simple program which creates and executes as thread using boost threads in c++.
#include<boost/thread/thread.hpp>
#include<iostream>
void hello()
{
std::cout<<"Hello, i am a thread"<<std::endl;
}
int main()
{
boost::thread th1(&hello);
th1.join();
}
The compiler throws an error against the th1.join() line. It says
"
Multiple markers at this line
- undefined reference to
`boost::thread::join()'
- undefined reference to
`boost::thread::~thread()'
"