Hi, I posted this a while ago but with no response, so I'm trying
again. If anyone is using the boost::threads library with gcc & STLPort
and has no problems, perhaps they could let me know - at least then I
know its worth perservering with (or at least try compiling my example?)
If I try to compile the example below with a makefile (also below), then
I get this linker error:
/home/ncain/tmp/ccaK5aes.o(.text+0x4b): In function `main':
: undefined reference to
`boost::thread::thread[in-charge](boost::function0boost::function_base > const&)'
If I don't use the _STL namespace it compiles. Looking at the libboost
libraries, they contain references to _STL stuff, so I assume I compiled
them ok (bjam -sTOOLS=gcc-stlport -sBUILD="<stlport-iostream>on" )
Does anyone know what could be wrong? (or how I can change a bjam file
to include the /usr/local/include/stlport path? so I could try that)
nik
testboost.cpp:
#include <iostream>
#include
#include
using namespace _STL;
struct thread_alarm
{
thread_alarm(int secs) : m_secs(secs) { }
void operator()()
{
cout << "alarm sounded..." << endl;
}
int m_secs;
};
int main(int argc, char* argv[])
{
int secs = 5;
thread_alarm alarm(secs);
boost::thread thrd(alarm);
thrd.join();
}
Makefile:
.PHONY: all clean
ALL = testboost
LIBS= -I/usr/local/include/stlport -I/home/ncain/boost_1_31_0
-L/usr/local/lib -lstlport_gcc -lboost_thread-gcc-mt-gdp
.cpp:
${CXX} -lpthread -o $@ $^ ${LIBS}
all: ${ALL}
clean:
${RM} core* *.o
${RM} ${ALL}