On Tue, 15 Jan 2008 21:47:39 +0100 jerome.wacongne@fxoverlay.com wrote:
Hi,
Here is what I get when I try to link my unit tests agains boost_date_time.
g++ -LC:\dev\workspace\fxoverlayFundation\Debug -LC:\dev\workspace\fxoverlayBusiness\Debug -LC:\dev\boost_1_34_1\stage\lib -ofxoverlayBusinessTests.exe emptyTests.o allTests.o InterestRateTests.o InterestCurveTests.o -lboost_date_time-mgw34-d-1_34_1 -lboost_unit_test_framework-mgw34-d-1_34_1 -lfxoverlayBusiness -lfxoverlayFundation C:\dev\workspace\fxoverlayBusiness\Debug/libfxoverlayBusiness.a(InterestCurve.o): In function `ZSt10_ConstructISt4pairIKSsN3com9fxoverlay8business1 2InterestRateEES6_EvPT_RKT0_': ... undefined reference to `boost::gregorian::greg_month::as_long_string() const'
Libraries should be listed (with the -l option) in "ascending order of use", that is, if library A uses library B, then library B should be listed after A. The error message says that libfxoverlayBusiness.a uses boost::gregorian, that is, libboost_date_time-mgw34-d-1_34_1.a, so libboost_date_time-mgw34-d-1_34_1.a should be listed after libfxoverlayBusiness.a, but you have listed it before. So: try to change the order of the "*.o" and "*.a" to make the linker happy. ;) HTH, Raul.