boost date-time conversion error

date dt{2018, 5, 14};
string str = to_simple_string(dt);
cout << str << endl;

error :
undefined reference to `boost::gregorian::greg_month::as_short_string() const'
undefined reference to `boost::gregorian::greg_month::as_long_string() const'


this code gives an error and i already spent 3 days behind it and nothing fruit full found. can any one help ?????? i am using c++ in netbeans.

"Undefined reference" means that when the linker went looking for the actual binary, compiled code that provides this function, it couldn't find it.

This means that the compiler had no problems with it, so the compiler must have seen the function declaration; typically in the header. This being a boost function, it means that you've include the right header (hence why the compiler is happy) but you have not linked against the boost library that contains the actual binary instructions that are the actual function operations.

Make sure you've got the right boost library, and that you've linked against it.

https://stackoverflow.com/questions/17477177/undefined-reference-to-boostgregoriangreg-monthas-short-string-const
Last edited on
Topic archived. No new replies allowed.