hi,
I'm new to boost, stlport and programming on linux in general, so I
apologise now for any obvious beginner errors!
I'm using mandrake 10 and gcc 3.3.2, and using root I created STLport
4.6.2 libraries, and then created all the boost 1.31.0 libraries using
bjam -sTOOLS=gcc-stlport -sBUILD="debug release <stlport-iostream>on"
install
I had to have this little lot in my bashrc file to do it;
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
export STLPORT_VERSION=4.6.2
export STLPORT_ROOT=/home/ncain
export STLPORT_LIB_DIRECTORY=/usr/local/lib
export STLPORT_INCLUDE_DIRECTORY=/usr/local/include/
export PYTHON_VERSION=2.3
export PYTHON_ROOT=/usr
Everything seemed to build ok, apart from an
"../lib/libstlport_gcc_debug.so does not exist" error in the final part
of the stlport build and a continual "warning: "_POSIX_C_SOURCE"
redefined" warning during the boost build. Both the stlport and boost
libraries are in /usr/local/lib ok, and building thread/test passed fine
too.
I altered one of the tutorial files to use _STL and also created a
makefile (since bjam is a bit beyond me at the moment), and these appear as;
testboost.cpp:
#include
#include
#include <iostream>
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
INCS = -I"/usr/local/include/stlport" \
-I"/usr/local/include/boost-1_31"
LIBS=-L"/usr/local/lib" -lstlport_gcc -lboost_thread-gcc-mt-p -lpthread
.cpp:
${CXX} ${INCS} -pthread -o $@ $^ ${LIBS}
all: ${ALL}
clean:
${RM} core* *.o
${RM} ${ALL}
make returns this error;
g++ -I"/usr/local/include/stlport" -I"/usr/local/include/boost-1_31"
-pthread -o testboost testboost.cpp -L"/usr/local/lib" -lstlport_gcc
-lboost_thread-gcc-mt-p -lpthread
/home/ncain/tmp/ccZWBPnj.o(.text+0x4b): In function `main':
: undefined reference to
`boost::thread::thread[in-charge](boost::function0boost::function_base > const&)'
collect2: ld returned 1 exit status
make: *** [testboost] Error 1
using -lboost_thread-gcc-mt-gdp makes no difference, however changing
the cpp to use the std libraries works fine (builds and runs correctly).
Have I made a mistake in building the boost libraries or possibly in my
makefile?
thanks,
nik