Boost logo

Boost Users :

From: Nicholas Cain (nik.cain.boost_at_[hidden])
Date: 2004-08-23 03:55:12

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
_STL::allocator<boost::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)


#include <iostream>
#include <boost/thread/thread.hpp>
#include <boost/thread/xtime.hpp>

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);

.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

    ${CXX} -lpthread -o $@ $^ ${LIBS}

all: ${ALL}

    ${RM} core* *.o
    ${RM} ${ALL}


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at