Re: [Boost-users] Test Tools Linking Problem
Gennadiy, I re-built the libs just as you said. I then copied the newly built static library to the stage/lib directory where I have all of the others. Unfortunately, I still got the same undefined. HOWEVER!... This is the first time I've noticed the boost_1_32_0/bin directory. I tried copying test_tools.obj into the directory with my own object files, added test_tools.obj to the list of my own object files in my make, and the link WORKED! To me, that says the Boost code if OK, but I've messed up makefile. (It's been many years since I've had to do battle with a raw makefile, and it wasn't GCC's make then.) I've appended an excerpt from my makefile. The "test" target is the one that gets the undefined referenced UNLESS test_tools.obj is included in the ${testobjs} list. (Yes, there is a TAB before ${CXX}.) What's wrong with the makefile? Merrill ---------------------------------------------------------------- basedir = E:/DigS boostdir = E:/boost_1_32_0 boostlibdir = ${boostdir}/stage/lib boostlibtype = -mgw-mt-1_32 boostlibs = ${boostlibdir}/boost_regex${boostlibtype}.dll boosttestlibs = ${boostlibdir}/libboost_unit_test_framework${boostlibtype}.lib . . . test : ${testobjs} ${CXX} -o test ${boosttestlibs} ${boostlibs} test.o ${testobjs}
I re-built the libs just as you said. I then copied the newly built static library to the stage/lib directory where I have all of the others. Unfortunately, I still got the same undefined. HOWEVER!...
This is the first time I've noticed the boost_1_32_0/bin directory. I tried copying test_tools.obj into the directory with my own object files, added test_tools.obj to the list of my own object files in my make, and the link WORKED!
You probable need to talk with Boost.Build guys how is it possible build library doesn't contain the object file. could you run ar on the library and print it content? Gennadiy
basedir = E:/DigS boostdir = E:/boost_1_32_0 boostlibdir = ${boostdir}/stage/lib boostlibtype = -mgw-mt-1_32 boostlibs = ${boostlibdir}/boost_regex${boostlibtype}.dll boosttestlibs = ${boostlibdir}/libboost_unit_test_framework${boostlibtype}.lib . . . test : ${testobjs} ${CXX} -o test ${boosttestlibs} ${boostlibs} test.o ${testobjs}
When linking with gcc the order in which the libraries and object files appear is *very* important, in particular any libraries you plan to link against must appear *after* the object files that require them, so I'm guessing you need: ${CXX} -o test ${testobjs} ${boosttestlibs} ${boostlibs} HTH, John.
participants (3)
-
Gennadiy Rozental
-
John Maddock
-
Merrill Cornish