Franck Guillaud wrote:
g++ -DUSE_DATE_TIME_PRE_1_33_FACET_IO -I"E:\dev\boost_1_33_1" -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"main.d" -MT"main.d" -o"main.o" "../main.cpp"
g++ -L"E:\dev\boost_1_33_1\stage\lib" -o"TestBOOST.exe" ./main.o -lboost_date_time-mgw-mt-d-1_33_1
I get the error (simplified output) :
E:/dev/boost_1_33_1/boost/date_time/gregorian/greg_weekday.hpp: undefined reference to `boost::gregorian::greg_month::as_long_string() const'
If I remove the lines with *to_simple_string*, I get no error.
From the docs [*] it seems there may be a problem for streams support for some compilers, so I tryed to define USE_DATE_TIME_PRE_1_33_FACET_IO in my project, but with no effect. Does it needs to be done when compiling boost ?
Is there any other way to solve my link problem ? (appart not using string output for dates :-) )
Thanks for any help.
Well, my guess is that somehow your -L option or the library name in the -l are incorrect. The difference is that to_simple_string depends on the function you can't find from the library while most of the rest of date-time code is inline. When you remove that function all the rest of date-time is compiling inline and hence no linker error. There's no reason I'm aware of to use the PRE_1_33_FACET_IO with mingw so I'd recommend staying away from to_simple_string and just writing: inline std::string my_simple_string(date d) { std::stringstream ss; ss << d; return ss.str(); } It's likely that as support for older compilers is dropped to_simple_string will be re-written in this fashion. HTH, Jeff